Closed (fixed)
Project:
Forms (obsolete)
Version:
master
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
26 Aug 2007 at 22:37 UTC
Updated:
22 Mar 2008 at 06:51 UTC
Hi!
This seems like the silliest oversight, but how can I add this Name attribute to a Form? I can add/change the Method, ID etc, but no name?
Weird.
TIA
Comments
Comment #1
dman commenteduse
For that and any extra attributes you want to add to form (or other) elements.
http://api.drupal.org/api/file/developer/topics/forms_api_reference.html...
Why 'name' anyway? isn't ID good enough for you?
Comment #2
toxicdesign commentedOh yeah :) Thanks man...
Why do I want a "Name" and not just ID?
Well I want to submit the form with javascript (when a user clicks on a radio button in the form), and I'm too scared to use:
document.getElementById('myorm').submit();
Instead of just the old fashioned way of "document.myform.submit();
If you have anysight into this, I'll listen!
Of course I'm sure there is a nice way to do this with jquery, but haven't had much success with that yet.
Cheers!
(and yes Drupal trully kicksass)
Comment #3
jaskegreen commentedDoes this work the same for adding a title to the form? For example, I want to add a title for a section of the form to give users a better understanding of what the section is about without having that title show in the Excel download.
Thanks,
Jason
Comment #4
dman commented"name" is an old HTML tag attribute. Not visible to the user.
You want to either -
- add an element to the form of #type=markup with the value of the text you want to insert
- add the text as a #prefix of a tag within the form
or
- use a fieldset to actually structure your sections.
None of these will change the way the data is saved.
Comment #5
jaskegreen commentedRight, so I created another fieldset called label and got it to come up as one of the choices when making a survey, but couldn't get it to pull the info from the db to show on the survey node. I know I'm missing that last part, but don't know what to change to get the label to print out on the page.
Any advice and examples of coding would be helpful.
Thanks,
Jason
PS - This would probably be better discussed in another issue I created for this topic. See http://drupal.org/node/202535.
Comment #6
quicksketchForms and survey modules are no longer being maintained, use Webform module instead.
---Closing down issue queue of survey module---