• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Q&A

Q1:If I use JavaScript to add validation and other features to my form, can users with non-JavaScript browsers still use the form?
A1: Yes, if you're careful. Be sure to use a Submit button rather than the submit action. Also, the CGI script may receive nonvalidated data, so be sure to include validation in the CGI script. Non-JavaScript users will be able to use the form, but won't receive instant feedback about their errors.
Q2:Can I add new form elements “on-the-fly” or change them—for example, change a text box into a password field?
A2: No. The form elements are set by the HTML code. There are ways to work around this, such as updating the form in a separate frame or layer.
Q3:Is there any way to create a large number of text fields without dealing with different names for all of them?
A3: Yes. If you use the same name for several elements in the form, their objects will form an array. For example, if you defined 20 text fields with the name member, you could refer to them as member[0] through member[19]. This also works with other types of form elements.
Q4:Why doesn't JavaScript recognize my form elements when I use a table to lay them out?
A4: Some versions of JavaScript do not deal well with forms or scripts within tables when <table> tags are nested. For now, the only solution is to avoid using nested tables.
Q5:Is there a way to place the cursor on a particular field when the form is loaded, or after my validation routine displays an error message?
A5: Yes. You can use the field's focus() method to send the cursor there. To do this when the page loads, you can use the onLoad method in the <body> tag. However, there is no way to place the cursor in a particular position within the field.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint