
Solid, safe website tools.
Whatever your need, Will Bontrager builds powerful software solutions.
|
(Get Attention Ticker for your web site)
Using JavaScript To Change Form Fields On-The-FlyBy Will Bontrager Sometimes a hidden (or other) form field needs to have its value changed depending on which, if any, radio button is checked or something is typed into a certain form field, or if other fields are checked or selected. We'll use a form created for Master Form V4 as our example. Let's suppose email template emailone.txt will be used when generating the email after the form is submitted. Let's further suppose one or two additional email templates will be used, depending on which radio button is checked and whether or not a text field contains information. As an aside, the form tag must have a name, like name="myform" for example. The name will be used by the JavaScript when the submit button is clicked. Here is our example form, complete with JavaScript to add the email template information: To test the form and JavaScript:
The first 2 lines of the form would then look something like this. If the text field isn't large enough to display all of the name="emailtemplate" value, it can be given a attribute size="100", or other size, so less scrolling is required to view the last bit of the value. After testing is complete, reverse the above changes. Your're good to go :) May 26, 2006 Please note: Articles on this website are presented "as is". However - If you have a question about a CGI script, HTML, CSS, PHP, or JavaScript
Rate this blog post.
No page reload! |
|
|
© 1998-2001 William and Mari Bontrager |
|