A ClientForm Question

N

narke

Does anyone here use ClientForm to handle a HTML form on client side?

I got a form, within which there is a image control, it direct me to
another page if i use mouse click on it. the code of the form as
below:

<form name="ZoomControl1:Form1" method="post"
action="CDocZ_MAG.aspx?Stat=DocZoom_DocZoom&amp;&amp;E=29YL53ZJBIEZ&amp;DT=ALB&amp;Pass=&amp;Total=104&amp;Pic=1&amp;o="
id="ZoomControl1_Form1" onkeydown="JavaScript:Navigation_ie();">

....

<input type="image" name="ZoomControl1:Imagebutton2" onclick="if
(typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); "
language="javascript" id="ZoomControl1_Imagebutton2"
src="../Images/Btn_GoImage.gif" border="0" />&nbsp;

....

</form>

So write below code to 'click' the image button,

forms = ParseResponse(urlopen(url))

form = forms[0]
urlopen(form.click("ZoomControl1:Imagebutton2"))

unfortunatly, however, when the code run, it just got a page which is
not the one i desired ( i actually wish to get the same page as i
'click' the button). I guess that is "onclick=" statement cause
something weird, but I do not understand it. And, in the source
containing the form, i found nowhere the Page_ClientValidate() resides.

What's wrong?

-
narke
 
F

Francesco

Il Fri, 01 Apr 2005 02:36:24 -0800, narke ha scritto:
Does anyone here use ClientForm to handle a HTML form on client side?

I got a form, within which there is a image control, it direct me to
another page if i use mouse click on it. the code of the form as
below:

<form name="ZoomControl1:Form1" method="post"
action="CDocZ_MAG.aspx?Stat=DocZoom_DocZoom&amp;&amp;E=29YL53ZJBIEZ&amp;DT=ALB&amp;Pass=&amp;Total=104&amp;Pic=1&amp;o="
id="ZoomControl1_Form1" onkeydown="JavaScript:Navigation_ie();">

...

<input type="image" name="ZoomControl1:Imagebutton2" onclick="if
(typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); "
language="javascript" id="ZoomControl1_Imagebutton2"
src="../Images/Btn_GoImage.gif" border="0" />&nbsp;

...

</form>

So write below code to 'click' the image button,

forms = ParseResponse(urlopen(url))

form = forms[0]
urlopen(form.click("ZoomControl1:Imagebutton2"))

unfortunatly, however, when the code run, it just got a page which is
not the one i desired ( i actually wish to get the same page as i
'click' the button). I guess that is "onclick=" statement cause
something weird, but I do not understand it. And, in the source
containing the form, i found nowhere the Page_ClientValidate() resides.

What's wrong?

-
narke

Similar problem for me.
In the form, i have
<input type="button" value="entra" class="button"
onClick="document.UserForm.submit()">
and i don't know how to click this.
urlopen(form.click()) doesn't nothing.
UserForm is the name of the form.

Francesco
 
J

John J. Lee

Francesco said:
Il Fri, 01 Apr 2005 02:36:24 -0800, narke ha scritto:

Yes. :)

[...]
forms = ParseResponse(urlopen(url))

form = forms[0]
urlopen(form.click("ZoomControl1:Imagebutton2"))

unfortunatly, however, when the code run, it just got a page which is
not the one i desired ( i actually wish to get the same page as i
'click' the button). I guess that is "onclick=" statement cause
something weird, but I do not understand it. And, in the source
containing the form, i found nowhere the Page_ClientValidate() resides.

Learn JS ;-/ Could be lots of things, read these:

http://wwwsearch.sourceforge.net/ClientForm/index.html#faq

http://wwwsearch.sourceforge.net/ClientCookie/doc.html#debugging

Similar problem for me.
In the form, i have
<input type="button" value="entra" class="button"
onClick="document.UserForm.submit()">
and i don't know how to click this.
urlopen(form.click()) doesn't nothing.
UserForm is the name of the form.

http://wwwsearch.sourceforge.net/ClientForm/index.html#faq


See second bullet point under "Why does .click()ing on a button not
work for me?".


John
 
N

narke

John J. Lee wrote,
See second bullet point under "Why does .click()ing on a button not
work for me?".

Thanks for you advice. However, after read through the FAQs, I have not
managed to find a solution for my problem. I belive my button is
coupled with some Java script which mess thing up and there is no a
easy solution. Am I right?

-
narke
 
S

Satchidanand Haridas

Hi,

ClientForm and Mechanize like tools do not execute javascript . You will
normally have to do them manually in your python code itself. In your
case, if you have a button, which (and I assume) executes some
javascript code that sets some hidden variable and/or changes the
'action' attribute of the form, you will have to change/assign those
elements in your python code itself.

ClientForm and mechanize can get tedious to use when one has a lot of
JavaScript functionality in the form.

Hope this answered your question... :)

regards,
Satchit
 
J

John J. Lee

narke said:
John J. Lee wrote,

work for me?".

Thanks for you advice. However, after read through the FAQs, I have not
managed to find a solution for my problem. I belive my button is
coupled with some Java script which mess thing up and there is no a
easy solution. Am I right?

Yes.


John
 

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,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top