Problem with FormPost - WeOnlyDo Discussion board

Problem with FormPost (General questions)

by Paul Draper, Tuesday, September 20, 2005, 15:37 (7003 days ago)

Hi,

I am trying to construct the following GET request using the FormPost example in the help files.


get http://devserver/tmtrack/tmtrack.dll?StdPage&Template=sframe

Note that StdPage posted attribute does not have a value.

I use the following code C++ code:

// set up url
http->URL = http://devserver/tmtrack/tmtrack.dll ;

// define search query
http->Request->FormPost->Add( StdPage , );
http->Request->FormPost->Add( Template , sframe );

http->URL = http->URL + ? + http->Request->FormPost->ToString();

This gives the following incorrect URL:


http://devserver/tmtrack/tmtrack.dll?StdPage
[color=#red]
=
[/color]
&Template=sframe


There seems to be a bug when you add a formpost with a name, but no value. The subsequent ToString() call puts an equals sign in when it shouldn't.

I have a workaround, but it requires me to process each formpost attribute myself and construct the correct URL.

Is this a bug?

Regards Paul.

Re: Problem with FormPost

by Paul Draper, Tuesday, September 20, 2005, 15:41 (7003 days ago) @ Paul Draper

Oops,

That'll teach me for trying to be clever with the formatting, the incorrect URL should read:

http://devserver/tmtrack/tmtrack.dll?StdPage=&Template=sframe

regards
Paul.

Re: Problem with FormPost

by wodSupport, Tuesday, September 20, 2005, 16:10 (7003 days ago) @ Paul Draper

Paul,

perhaps I didn't understand. What you say is incorrect looks ok to me. If <code>http://devserver/tmtrack/tmtrack.dll?StdPage=&Template=sframe</code> is invalid for StdPage = and Template = sframe , how do you think correct should look like?

BTW, what does FormPost has to do with changes in URL? FormPost posts data in the body, not in URL.

Kreso

Re: Problem with FormPost

by Paul Draper, Tuesday, September 20, 2005, 16:51 (7003 days ago) @ wodSupport

Hi Kreso,

Componant generates:

<code>http://devserver/tmtrack/tmtrack.dll?StdPage=&Template=sframe</code>

The web page I'm going to expects the URL

<code>http://devserver/tmtrack/tmtrack.dll?StdPage&Template=sframe</code>

It's a very subtle difference, the unneccessary = in the =& causes the problem.

The receiving page thinks that the variable StdPage has the value &Template=sframe and thus goes wrong!

Regards
Paul.

Re: Problem with FormPost

by Paul Draper, Tuesday, September 20, 2005, 16:56 (7003 days ago) @ Paul Draper

Hi Kreso,

In answer to your second question:


BTW, what does FormPost has to do with changes in URL? FormPost posts data in the body, not in URL.

I am making use of the trick described in the FormPost help page for adding FormPost variables from the body onto the URL when you are performing a GET.

I imagine the bug is in the way that

[code]wodHttp1.Request.FormPost.ToString()[/code]

is constructing the string of all the formpost variables.

regards
Paul.

Re: Problem with FormPost

by wodSupport, Tuesday, September 20, 2005, 18:40 (7003 days ago) @ Paul Draper

Paul,

actually, I think this is server-side issue. If I use Internet Explorer with code like this in local.htm file: [code]<html>
<form action= http://www.somepage.com method=GET>
<input name= StdName value= >
<input name= Template value= something >
<input type=Submit>
</form></html>[/code], open it, and click on 'submit' button, IE redirects me to this URL: [code]http://www.somepage.com/?StdName=&Template=something[/code]
As you can see - IE did add = just like wodHttpDLX. So, I don't think we have a bug.

Re: Problem with FormPost

by Paul Draper, Wednesday, September 21, 2005, 10:46 (7002 days ago) @ wodSupport

Hi Kreso,

It appears that somepage.com is happy with either
[code]http://somepage.com/?StdName=&Template=something
or
http://somepage.com/?StdName&Template=something[/code]

unfortunatly the webserver I'm going to objects to the URL that has the =& in it.

seems that they are misusing the syntax.

Thanks for you help
Paul.