469,349 Members | 1,485 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,349 developers. It's quick & easy.

get form url without submit

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

Feb 15 '07 #1
6 3768
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.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 15 '07 #2
"finecur" <fi*****@yahoo.comwrote in message
news:11**********************@q2g2000cwa.googlegro ups.com...
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.
Feb 15 '07 #3
"Bosconian" <no****@nowhere.comwrote in
news:Pt******************************@comcast.com:
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?

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.
It would simplify the task if you could give the form a name or an id.
Feb 15 '07 #4
Randy Webb wrote:
finecur said the following on 2/14/2007 7:56 PM:
....

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.
?
Feb 15 '07 #5
ASM
optimistx a écrit :
Randy Webb wrote:
>finecur said the following on 2/14/2007 7:56 PM:

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) ...
>>the form. Is there a way to do that without submit the form?
Yes.

?
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.

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Feb 15 '07 #6
On Feb 15, 1:38 am, ASM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
optimistx a écrit :
Randy Webb wrote:
>finecursaid the following on 2/14/2007 7:56 PM:
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) ...
>the form. Is there a way to do that without submit the form?
Yes.
?

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.

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Thank you for your post. What about if I have a <input type=filein
my form? How can I manually make the aciton ?

Thanks again

Mar 2 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Johan | last post: by
4 posts views Thread by Tauqir | last post: by
6 posts views Thread by catherine.bajis | last post: by
2 posts views Thread by sandy786 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.