I want to loop through a form containing various fields and replace them with values I have in a JS object.
<input type="text" name="field_1" value="" />
<input type="checkbox" name="field_2" value="" />
object.field_1 = "Dave";
object.field_2 = ""; // empty as not checked, else holds value of checked one
The problem is: what about checkboxes and <select> drop downs, and radios??
Is there a script like this around as I'm guessing this could be useful for Ajax to populate input boxes in some situations (depending on the content etc.) so I'm guessing I'm not the only one who needs this?
A script can determine which of those types of fields a given form field is from its nodeName and type attribute, and automatically adjust its behaviour based on which one it is.
This topic is now closed. New replies are no longer allowed.