[thelist] javascript this.submit

Warden, Matt mwarden at mattwarden.com
Thu Mar 7 22:29:01 CST 2002


On Mar 7, George Klingenhoffer had something to say about [thelist]...

>I have a form with a checkbox; when the box is checked or unchecked, I want
>the form to submit.  It works fine in the newer browsers but not Netscape
>4.  I don't necessarily need for it to work in Netscape but I don't want it
>to cause a javascript error
>
>That being said, what's the best way for me to do the following code:
>
><form....>
>Show Only Northwest Artists <input type="checkbox" name="searchnorthwest"
>onClick="frm_search.submit();" <%=checknw%>><br>
>Show Records: <select name="showrecords" size="1"
>onChange="frm_search.submit();">
>	<option <%=twentyfiveselected%>>25</option>
>	<option <%=fiftyselected%>>50</option>
>	<option <%=hundredselected%>>100</option>
></select>
></form>

you need to preceed the form object with "document." the shortcut you use
only works in IE, AFAIK. so:

onClick="document.frm_search.submit();"

if, for some reason, this is still causing an error (like if you're
conditionally displaying the form to be submitted or something), try this:

onClick="if(document.frm_search)document.frm_search.submit();"

hth,

--
mattwarden
mattwarden.com




More information about the thelist mailing list