get form url without submit

F

finecur

Hi, here is my html:

<form action='mycgi.do'>
<input type=text name=a value=1>
<input type=text name=b value=1>
<input type=submit>
</form>

If I click the submit button, it will take me to mycgi.do?a=1&b=1.

Now my html got complicated. The fields inside the form as dynimacally
added/removed. And I do not want to leave my current page. But I just
want to get the target url (mycgi.do?a=1&b=1) of the form. Is there a
way to do that without submit the form?

Thanks,
f
 
R

Randy Webb

finecur said the following on 2/14/2007 7:56 PM:
Hi, here is my html:

<form action='mycgi.do'>
<input type=text name=a value=1>
<input type=text name=b value=1>
<input type=submit>
</form>

If I click the submit button, it will take me to mycgi.do?a=1&b=1.

Now my html got complicated. The fields inside the form as dynimacally
added/removed. And I do not want to leave my current page. But I just
want to get the target url (mycgi.do?a=1&b=1) of the form. Is there a
way to do that without submit the form?

Yes.
 
B

Bosconian

finecur said:
Hi, here is my html:

<form action='mycgi.do'>
<input type=text name=a value=1>
<input type=text name=b value=1>
<input type=submit>
</form>

If I click the submit button, it will take me to mycgi.do?a=1&b=1.

Now my html got complicated. The fields inside the form as dynimacally
added/removed. And I do not want to leave my current page. But I just
want to get the target url (mycgi.do?a=1&b=1) of the form. Is there a
way to do that without submit the form?

Thanks,
f

You can, of course, easily determine the value of the action attribute, but
you'll need to manually build the query string portion by looping through on
the elements.
 
A

ASM

optimistx a écrit :
But I just want to get the target url (mycgi.do?a=1&b=1) of

That is not the target but the action (of your form) ...

Ways are infinite :)

example :

<form action='mycgi.do'
onsubmit="return confirm('This action is :\n'+
this.action+'?a='+this.a.value+'&b='+this.b.value+'\n'+
'Is it OK ?');">
<input type=text name=a value=1>
<input type=text name=b value=1>
<input type=submit>
</form>

Tell exactly what you want.
 
F

finecur

optimistx a écrit :



That is not the target but the action (of your form) ...



Ways are infinite :)

example :

<form action='mycgi.do'
onsubmit="return confirm('This action is :\n'+
this.action+'?a='+this.a.value+'&b='+this.b.value+'\n'+
'Is it OK ?');">
<input type=text name=a value=1>
<input type=text name=b value=1>
<input type=submit>
</form>

Tell exactly what you want.

Thank you for your post. What about if I have a <input type=file> in
my form? How can I manually make the aciton ?

Thanks again
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top