input type="image"

Results 1 to 2 of 2

Thread: input type="image"

  1. #1
    Join Date
    Dec 1969

    Default input type="image"

    Hi all!!<BR><BR>I was using a input type="button" and now I am using input type="image" but when submitted page is was not refreshing the page when I was using the button...<BR><BR>here is the function I am using on click of the button<BR><BR><BR>function Co(obj)<BR> {<BR> <BR> <BR> if(!obj.OC.value==&#039;&#039;)<BR> {<BR> if (validEmail(obj.OC))<BR> {<BR> obj.list.options[obj.list.length]=new Option(obj.OC.value,obj.OC.value);<BR><BR> } <BR> }<BR> <BR> <BR> <BR> <BR> <BR> } <BR><BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default Just ran into this today!

    In helping another person.<BR><BR>Problem is that, with a button, you can do this:<BR> &#060;INPUT Type=Button onClick="whatever( );"&#062;<BR>and only the whatever() code is invoked.<BR><BR>And with a submit button you can do this:<BR> &#060;INPUT Type=Submit onClick="whatever( ); return false;"&#062;<BR>and that "return false" will prevent the submit from actually happening.<BR><BR>But an image button can&#039;t be stopped via return false: It *always* submits the &#060;FORM&#062; containing it.<BR><BR>Our solution was simple:<BR> &#060;FORM onSubmit="return false;"&#062;<BR>we simply prevented the form from *ever* submitting via that onSubmit code.<BR><BR>If you needed the form to submit for *some* reason (say a conventional button?) you could just code<BR> &#060;INPUT Type=Button onClick="this.form.submit();"&#062;<BR>because a direct call to the submit() method bypasses the onSubmit check.<BR><BR>

Posting Permissions

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