CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Other Programming Languages: Javascript:
submit/reset problem

 



parham_m_s
journeyman

May 15, 2001, 1:36 PM

Post #1 of 3 (7978 views)
submit/reset problem Can't Post

i have forms around my script which have different form names. I am submitting and resetting my forms through javascript.

here's the submitting part of it ('mainform' is the name of the form), i did it this way so i can change the name of the form easily:

Code
<A HREF="javascript:form_submit('mainform')"><IMG SRC="submit.gif" BORDER=0></A>

and here's the submit javascript part of it:

Code
function form_submit(selected_form) { 
document.selected_form.submit();
}

i keep getting an error, but i don't know why. I'm not completely familiar with javascript, so passing information is very new to me. Any help is appreciated, thank you.



parham_m_s
journeyman

May 17, 2001, 5:07 PM

Post #2 of 3 (7970 views)
Re: submit/reset problem [In reply to] Can't Post

anyone please, i'm still kinda stuck on this. I've shortened the code if anyone didn't understand. The form won't submit or reset still.

Code
<HTML> 
<HEAD>
<TITLE>test</TITLE>
</HEAD>
<BODY>
<script language="JavaScript">

</script>
<FORM NAME="mainform" ACTION="http://www.webcrawler.com" METHOD=GET>
<INPUT TYPE="text" VALUE="something">
<A HREF="javascript:form_submit('mainform')">submit</A> <A HREF="javascript:form_reset('mainform')">reset</A>
</FORM>
</BODY>
</HTML>



freddo
User

May 22, 2001, 10:45 AM

Post #3 of 3 (7962 views)
Re: submit/reset problem [In reply to] Can't Post

Hello Param,

here's my try at it:

Code
<html> 
<body>

<form name="mainform" action="test.html">
<A HREF="javascript:form_submit('mainform')">Test2</A>
</form>

<script language="JavaScript">
function form_submit(selected_form) {
document.forms[selected_form].submit();
}
</script>
</body>
</html>

you can find more info on javascript here.

see you
freddo

;---
Real programmers don't eat cache.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives