Form Submission

Results 1 to 2 of 2

Thread: Form Submission

  1. #1
    Join Date
    Dec 1969

    Default Form Submission

    I have a form with some java that checks the info entered before submitting. It works great whenever I click the submit button. However, when I press return on my keyboard, the code isn&#039;t run and the form submits. This makes sense, seeing as the javascript is on my button, but is there a way I can force it to run the java when enter is pressed as well? Here&#039;s my code if it helps...<BR><BR>function MM_updateRecord(form,action) {<BR> if ( form.ProductCode.value == "" ) {<BR> alert("Please enter a Product SKU");<BR> } else {<BR> form.action.value = action;<BR> form.submit();<BR> } <BR>}<BR><BR>&#060;input type="button" class="button" onClick="javascript:MM_updateRecord(this.form,&#03 9;Add&#039;);" value="Add"&#062;<BR><BR>Thanks,<BR>Wil<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Form Submission

    Well it&#039;s not a submit button so it will not be seen.<BR><BR>Instead use.<BR><BR><BR>function MM_updateRecord(form,action) {<BR>if ( form.ProductCode.value == "" ) {<BR>alert("Please enter a Product SKU");<BR>return false;<BR>} else {<BR>form.action.value = action;<BR>return true;<BR>} <BR>}<BR><BR>&#060;FORM name="form" method="post" action="" onSubmit="return MM_updateRecord(this.form,&#039;Add&#039;)"&#062;< BR><BR><BR>&#060;input type="submit" class="button" value="Add"&#062;<BR><BR><BR>jc

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts