charlie_M wrote:
I have a number of applications where I want to have many
onclick='submit()' attached to different 'elements' on a single form
..... which sends the form to a CGI "script" which does all the
validation. The problem is.. how can I code the submit()s so the CGI's
form collection knows which 'element' was clicked??
I am NOT permitted to use <input type=image...> or any "button" that
browsers produce for forms.... the reasons are all client related
;o)))
If I can put a string inside the parentheses (i.e.
onclick='submit("thisbutton")'.... and have it's characters included in
the POST information to the CGI.. It will work for me. Can this be
done?? how?
onclick="someFunction(this.id)"
<input type="text" name="inputUsed">
function someFunction(inputID){
document.forms['formName'].elements['inputUsed'].value = inputID;
document.forms['formName'].submit();
}
And in each of your "elements" have an ID attribute that identifies it.
In other words, instead of using the element to submit the form, have
the element give a function its ID attribute, set a form field to that
value, then submit the form. Then, the server can pick up the value of
inputUsed to determine what element was used to submit the form.
And I won't go into the ludicrous idea of setting up a webpage the way
you are describing. If your client is that ignorant, its *your* job as
the professional to educate them on the pitfalls of the design.
Accessibility, non-JS, and many other issues make the entire approach a
bad design before you have ever started.
--
Randy
comp.lang.javascript FAQ -
http://jibbering.com/faq & newsgroup weekly