<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1458" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Thanks for the suggestions, Flavio.&nbsp; Here's 
what I've learned.&nbsp; Apparantly, the <EM>-onsubmit</EM> clause needs to be 
associated with the form&nbsp;to scope&nbsp;the form elements&nbsp;into the 
<FONT face="Times New Roman" size=3>checkForm( )</FONT> function.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
  <DIV><FONT face=Arial size=2># Client-side JavaScript Generated with the Perl 
  CGI:</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV>print qq(&lt;script&gt;&lt;!--<BR>&nbsp;&nbsp;&nbsp; function checkForm ( 
  form ) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var 
  clicked=arguments[1];&nbsp; &nbsp;// do this for "readability"; . . .points to 
  2nd arg!<BR></DIV>
  <DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( clicked = = 
  "Update")</DIV>
  <DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ||&nbsp; &nbsp;clicked = = 
  "Insert") 
  {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( 
  form["vendor_name"].value = = "") 
  {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  alert("Vendor Name is 
  required");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  return 
  false;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  }<BR><FONT face=Arial 
  size=2>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<EM>&nbsp;&nbsp;&nbsp;&nbsp; other 
  similar conditionals can be added per above.</EM></FONT></DIV>
  <DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 
  true;<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; // 
  --&gt;&lt;/script&gt;<BR>);<BR><FONT face=Arial size=2>~</FONT></DIV>
  <DIV><FONT face=Arial size=2>~ <EM>etc.</EM></FONT></DIV>
  <DIV><FONT face=Arial 
  size=2>~</FONT><BR>$cgi-&gt;start_form(-action=&gt;'vendors_01.pl',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  -method=&gt;'GET',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  -name=&gt;'vendors_01.pl',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  -onsubmit=&gt;"return checkForm( this, clicked )"<BR>&nbsp;&nbsp;&nbsp; 
  );<BR></DIV></BLOCKQUOTE>
<DIV dir=ltr><FONT face=Arial size=2>The submit buttons are defined as 
follows:</FONT></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
  <DIV dir=ltr>$cgi-&gt; submit(-name=&gt;"action", 
  -value=&gt;"Inquire",&nbsp;&nbsp; -onclick=&gt;"clicked=value"),<BR>$cgi-&gt; 
  submit(-name=&gt;"action", -value=&gt;"Update",&nbsp; 
  -onclick=&gt;"clicked=value"),<BR>$cgi-&gt; submit(-name=&gt;"action", 
  -value=&gt;"Insert",&nbsp;&nbsp;&nbsp;&nbsp; 
  -onclick=&gt;"clicked=value"),<BR>$cgi-&gt; submit(-name=&gt;"action", 
  -value=&gt;"Delete",&nbsp;&nbsp;&nbsp; 
-onclick=&gt;"clicked=value"),</DIV></BLOCKQUOTE>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I'm not sure exactly how the value assigned to the 
var, "clicked" is passed to the checkForm functions, but is is passed as the 
second argument to the function.&nbsp; It does work.</FONT><BR></DIV>
<DIV><FONT face=Arial size=2>OTTF,<BR>Ron Wingfield</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=1>FreeBSD 4.8&nbsp; --&nbsp; Apache http 2.0.28 -- 
MySQL client/server 4.1.7<BR>Perl 5.8.5 -- p5-DBD-mysql-2.9004 driver -- 
p5-DBI-1.46</FONT><BR></DIV>
<DIV>
<HR>
</DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=flavio@economisa.com.br href="mailto:flavio@economisa.com.br">Flavio 
  Gomes</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=javascript@LaTech.edu 
  href="mailto:javascript@LaTech.edu">[JavaScript List]</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, January 21, 2005 12:02 
  PM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Javascript] Test or 
  Identify Value of Submit Button's AssignedValue</DIV>
  <DIV><FONT face=Arial size=2></FONT><FONT face=Arial 
  size=2></FONT><BR></DIV>Hello Ron,<BR><BR><BR>Maybe changing&nbsp; your 
  checkForm to something 
  like<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function 
  checkForm(pressedSubmit)&nbsp;&nbsp; { ... }<BR><BR>then call it 
  as<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;input 
  type=submit onclick="checkForm(this.value)" name=action 
  <BR>value=Inquire&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &lt;input type=submit onclick="checkForm(this.value)" name=action 
  <BR>value=Update&gt;<BR><BR>Or you could set a variable initiated with the 
  default "value" of the <BR>submit, and when the user clicks the button (the 
  submit) it changes the <BR>variable value to it's(button's) 
  value.<BR><BR>--<BR>Flavio Gomes<BR><A 
  href="mailto:flavio@economisa.com.br">flavio@economisa.com.br</A><BR><BR><BR><BR>Ron 
  Wingfield wrote:<BR><BR>&gt; I have defined some submit buttons, e.g., assoc/w 
  "Inquire", "Update", <BR>&gt; etc.,&nbsp; as follows:<BR>&gt;&nbsp; 
  <BR>&gt;<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; $cgi-&gt; submit(-name=&gt;"action", 
  -value=&gt;"Inquire"),<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; $cgi-&gt; 
  submit(-name=&gt;"action", -value=&gt;"Update"),<BR>&gt;<BR>&gt; Regarding the 
  first "if" condition in the following JavaScript code <BR>&gt; (from the 
  checkForm function executed -onsubmit), the value of&nbsp; " <BR>&gt; 
  form["action"].value " is /undefined/ (. . .at least at the point in <BR>&gt; 
  my code); however, the value of " form[''name"].value " is the value <BR>&gt; 
  as typed in the form's /Name/ field. 
  <BR>&gt;<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  if ( form["action"].value == "Update") 
  {<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  if ( form["name"].value == "") 
  {<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  alert("Name is 
  required");<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  return 
  false;<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  }<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  }<BR>&gt;<BR>&gt; Obviously, the following -onsubmit condition is executing 
  the <BR>&gt; JavaScript.&nbsp; In the client-side JavaScript, how do I test 
  the value of <BR>&gt; the clicked submit button?&nbsp; In other words, I need 
  to know which <BR>&gt; submit button was 
  clicked.<BR>&gt;<BR>&gt;<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; 
  $cgi-&gt;start_form(-action=&gt;'vendors_01.pl',<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  -method=&gt;'GET',<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  -name=&gt;'vendors_01.pl',<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  -onsubmit=&gt;"return checkForm( this );" );<BR>&gt;<BR>&gt; Thanks,<BR>&gt; 
  Ron Wingfield<BR>&gt;&nbsp; <BR>&gt; FreeBSD 4.8&nbsp; --&nbsp; Apache http 
  2.0.28 -- MySQL client/server 4.1.7<BR>&gt; Perl 5.8.5 -- p5-DBD-mysql-2.9004 
  driver -- 
  p5-DBI-1.46<BR><BR><BR>_______________________________________________<BR>Javascript 
  mailing list<BR><A 
  href="mailto:Javascript@LaTech.edu">Javascript@LaTech.edu</A><BR><A 
  href="https://lists.LaTech.edu/mailman/listinfo/javascript">https://lists.LaTech.edu/mailman/listinfo/javascript</A><BR></BLOCKQUOTE></BODY></HTML>