A ClientForm Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • narke

    #1

    A ClientForm Question

    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="ZoomContr ol1:Form1" method="post"
    action="CDocZ_M AG.aspx?Stat=Do cZoom_DocZoom&a mp;&amp;E=29YL5 3ZJBIEZ&amp;DT= ALB&amp;Pass=&a mp;Total=104&am p;Pic=1&amp;o="
    id="ZoomControl 1_Form1" onkeydown="Java Script:Navigati on_ie();">

    ....

    <input type="image" name="ZoomContr ol1:Imagebutton 2" onclick="if
    (typeof(Page_Cl ientValidate) == 'function') Page_ClientVali date(); "
    language="javas cript" id="ZoomControl 1_Imagebutton2"
    src="../Images/Btn_GoImage.gif " border="0" />&nbsp;

    ....

    </form>

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

    forms = ParseResponse(u rlopen(url))

    form = forms[0]
    urlopen(form.cl ick("ZoomContro l1: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_ClientVali date() resides.

    What's wrong?

    -
    narke

  • Francesco

    #2
    Re: A ClientForm Question

    Il Fri, 01 Apr 2005 02:36:24 -0800, narke ha scritto:
    [color=blue]
    > 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="ZoomContr ol1:Form1" method="post"
    > action="CDocZ_M AG.aspx?Stat=Do cZoom_DocZoom&a mp;&amp;E=29YL5 3ZJBIEZ&amp;DT= ALB&amp;Pass=&a mp;Total=104&am p;Pic=1&amp;o="
    > id="ZoomControl 1_Form1" onkeydown="Java Script:Navigati on_ie();">
    >
    > ...
    >
    > <input type="image" name="ZoomContr ol1:Imagebutton 2" onclick="if
    > (typeof(Page_Cl ientValidate) == 'function') Page_ClientVali date(); "
    > language="javas cript" id="ZoomControl 1_Imagebutton2"
    > src="../Images/Btn_GoImage.gif " border="0" />&nbsp;
    >
    > ...
    >
    > </form>
    >
    > So write below code to 'click' the image button,
    >
    > forms = ParseResponse(u rlopen(url))
    >
    > form = forms[0]
    > urlopen(form.cl ick("ZoomContro l1: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_ClientVali date() resides.
    >
    > What's wrong?
    >
    > -
    > narke[/color]

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

    Francesco

    Comment

    • John J. Lee

      #3
      Re: A ClientForm Question

      Francesco <francesco@f0x. it> writes:
      [color=blue]
      > Il Fri, 01 Apr 2005 02:36:24 -0800, narke ha scritto:
      >[color=green]
      > > Does anyone here use ClientForm to handle a HTML form on client side?[/color][/color]

      Yes. :-)

      [...][color=blue][color=green]
      > > forms = ParseResponse(u rlopen(url))
      > >
      > > form = forms[0]
      > > urlopen(form.cl ick("ZoomContro l1: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_ClientVali date() resides.[/color][/color]

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





      [color=blue]
      > Similar problem for me.
      > In the form, i have
      > <input type="button" value="entra" class="button"
      > onClick="docume nt.UserForm.sub mit()">
      > and i don't know how to click this.
      > urlopen(form.cl ick()) doesn't nothing.
      > UserForm is the name of the form.[/color]




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


      John

      Comment

      • narke

        #4
        Re: A ClientForm Question

        John J. Lee wrote,
        [color=blue]
        > See second bullet point under "Why does .click()ing on a button not[/color]
        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

        Comment

        • Satchidanand Haridas

          #5
          Re: A ClientForm Question

          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


          narke wrote:
          [color=blue]
          >John J. Lee wrote,
          >
          >
          >[color=green]
          >>See second bullet point under "Why does .click()ing on a button not
          >>
          >>[/color]
          >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
          >
          >
          >[/color]

          Comment

          • John J. Lee

            #6
            Re: A ClientForm Question

            "narke" <steven@lczmsof t.com> writes:
            [color=blue]
            > John J. Lee wrote,
            >[color=green]
            > > See second bullet point under "Why does .click()ing on a button not[/color]
            > 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?[/color]

            Yes.


            John

            Comment

            Working...