How to submit dynamically generated hidden forms

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

    How to submit dynamically generated hidden forms

    Hi,

    As the subject says, I would like to submit dynamically generated
    hidden forms with javascript. I'm fairly new to javascript. I've
    googled around but couldn't find a solution. I would appreciate if
    someone can point me to the right direction.

    Thanks

  • Ivan Marsh

    #2
    Re: How to submit dynamically generated hidden forms

    On Tue, 09 Aug 2005 08:50:59 -0700, P wrote:
    [color=blue]
    > Hi,
    >
    > As the subject says, I would like to submit dynamically generated
    > hidden forms with javascript. I'm fairly new to javascript. I've
    > googled around but couldn't find a solution. I would appreciate if
    > someone can point me to the right direction.
    >
    > Thanks[/color]

    submit() function.



    --
    "Blessed is he who expects nothing, for he shall never be disappointed."
    Benjamin Franklin (I didn't know he was a Buddhist)

    Comment

    • P

      #3
      Re: How to submit dynamically generated hidden forms

      On the site you've provided, it gave this example:

      <form name="myform" action="handle-data.php">
      Search: <input type='text' name='query'>
      <A href="javascrip t: submitform()">S earch</A>
      </form>
      <SCRIPT language="JavaS cript">
      function submitform()
      {
      document.myform .submit();
      }
      </SCRIPT>

      What I'm hoping to do is to have a function like that, but takes an
      argument for the name of the form. This is probably the wrong syntax
      but I think it shows what I want to do:

      function submitform(form ID)
      {
      document.formID .submit();
      }

      Comment

      • Ivan Marsh

        #4
        Re: How to submit dynamically generated hidden forms

        On Tue, 09 Aug 2005 10:16:08 -0700, P wrote:
        [color=blue]
        > On the site you've provided, it gave this example:
        >
        > <form name="myform" action="handle-data.php">
        > Search: <input type='text' name='query'> <A href="javascrip t:
        > submitform()">S earch</A> </form>
        > <SCRIPT language="JavaS cript">
        > function submitform()
        > {
        > document.myform .submit();
        > }
        > </SCRIPT>
        >
        > What I'm hoping to do is to have a function like that, but takes an
        > argument for the name of the form. This is probably the wrong syntax
        > but I think it shows what I want to do:
        >
        > function submitform(form ID)
        > {
        > document.formID .submit();
        > }[/color]

        IIRC the form name isn't a valid object in any browser.

        I think the submit function has to be called in the body of the form...
        but I may be wrong about that.

        --
        "Blessed is he who expects nothing, for he shall never be disappointed."
        Benjamin Franklin (I didn't know he was a Buddhist)

        Comment

        • P

          #5
          Re: How to submit dynamically generated hidden forms

          Yes, you are correct. The function I wrote is not valid. But is it
          possible to do something similar?

          Comment

          • Martin Honnen

            #6
            Re: How to submit dynamically generated hidden forms



            P wrote:

            [color=blue]
            > function submitform(form ID)
            > {
            > document.formID .submit();[/color]


            If the form has an id attribute and you pass its value in as the formID
            parameter then you can use
            var form;
            if (document.getEl ementById && (form =
            document.getEle mentById(formID ))) {
            form.submit();
            }



            --

            Martin Honnen

            Comment

            • P

              #7
              Re: How to submit dynamically generated hidden forms

              aaaah, I see. Thanks Martin :)

              Comment

              Working...