You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Jeffrey Porter <PO...@WMGMAIL.wmg.warwick.ac.uk> on 2006/10/02 10:44:21 UTC

RE: How to set a Forms action value?

Hi Roland, 

I've read this but and none the wiser.

I have the following in the web page...


<SCRIPT LANGUAGE="Javascript"
	function validateAndSubmit(frm)
	{
		frm.action="PartsForSupplier";
		frm.submit();
	}
</SCRIPT>
....
<form name="PartsForSupplierForm" method="post">
....
</form>


So as you can see the action parameter of the form is set in the
javascript.

The link you passed over states that the URL that is requested is the
target of the form. 

Using HTTP Analyzer, I can see the following, i.e the URL requested is
the same as the action set in the javascript.

----------------------------------------
POST /code/PartsForSupplier HTTP/1.1
Referer: https://web.bakert.com/code/PartsForSupplier
----------------------------------------

So....

My question is, is the action set on the form the same as the URL
requested?

In my HTTPClient code I post request the URL with the NameValuePairs
that are set in the form, but all I get back in the original search
page. i.e. 
the page with no results.

Can anyone help me out a bit here?

Thanks
Jeff porter




-----Original Message-----
From: Roland Weber [mailto:http-async@dubioso.net] 
Sent: 29 September 2006 18:48
To: HttpClient User Discussion
Subject: Re: How to set a Forms action value?

Hi Jeff,

> I'm trying to submit a post request to a page that contains a form
with
> some values.
> 
> I can set the values, but the page has javascript that sets the form's
> action value to 'doStuff'.
> 
>  
> 
> How do I set this in my httpclient java code?

The action value of the form is the target URL for your POST request.
Have you taken a look at the primer?
http://wiki.apache.org/jakarta-httpclient/ForAbsoluteBeginners#head-93d0
17d102ea8a83b2ad6e07c5184ec2f922f09a

cheers,
  Roland

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


RE: How to set a Forms action value?

Posted by Jeffrey Porter <PO...@WMGMAIL.wmg.warwick.ac.uk>.
SOLVED

The URL is the same as the action value of the form.

My problem was due to me not setting a NameValuePair.

The NameValuePair concered does not have a value, it is...

NameValuePair thepart  = new NameValuePair("part" , "");

I presumed that because it was empty, that is was not used.

I was wrong.

Jeff porter



-----Original Message-----
From: Jeffrey Porter [mailto:PORTER_J@wmgmail.wmg.warwick.ac.uk] 
Sent: 02 October 2006 09:44
To: HttpClient User Discussion
Subject: RE: How to set a Forms action value?


Hi Roland, 

I've read this but and none the wiser.

I have the following in the web page...


<SCRIPT LANGUAGE="Javascript"
	function validateAndSubmit(frm)
	{
		frm.action="PartsForSupplier";
		frm.submit();
	}
</SCRIPT>
....
<form name="PartsForSupplierForm" method="post">
....
</form>


So as you can see the action parameter of the form is set in the
javascript.

The link you passed over states that the URL that is requested is the
target of the form. 

Using HTTP Analyzer, I can see the following, i.e the URL requested is
the same as the action set in the javascript.

----------------------------------------
POST /code/PartsForSupplier HTTP/1.1
Referer: https://web.bakert.com/code/PartsForSupplier
----------------------------------------

So....

My question is, is the action set on the form the same as the URL
requested?

In my HTTPClient code I post request the URL with the NameValuePairs
that are set in the form, but all I get back in the original search
page. i.e. 
the page with no results.

Can anyone help me out a bit here?

Thanks
Jeff porter




-----Original Message-----
From: Roland Weber [mailto:http-async@dubioso.net] 
Sent: 29 September 2006 18:48
To: HttpClient User Discussion
Subject: Re: How to set a Forms action value?

Hi Jeff,

> I'm trying to submit a post request to a page that contains a form
with
> some values.
> 
> I can set the values, but the page has javascript that sets the form's
> action value to 'doStuff'.
> 
>  
> 
> How do I set this in my httpclient java code?

The action value of the form is the target URL for your POST request.
Have you taken a look at the primer?
http://wiki.apache.org/jakarta-httpclient/ForAbsoluteBeginners#head-93d0
17d102ea8a83b2ad6e07c5184ec2f922f09a

cheers,
  Roland

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org