Is this possible?

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

    #1

    Is this possible?

    <script>

    /*
    I would like to write a function that, onclick
    post ONLY input A, not B.
    Is it possible?
    */
    function f(){
    document.F.B /* destroy */
    document.F.subm it();
    }

    </script>


    <form name="F" method="get">
    <input type="text" name="A">
    <input type="text" name="B">
    <input type="button" value="click" onclick="f();">
    </form>

    Is it possible?

    Any help appreciated.

    Regards.

    --
    Fabri
    (Incredibile come si tenda a credere di piu` a Rossi. (cit.))
  • Rob B

    #2
    Re: Is this possible?



    That won't post anything if JavaScript is disabled. Why not go:

    <form name="F" method="get" onsubmit="B.dis abled=true">

    You could also 'un-name' it ("B.name=''" ) - disabled and un-named form
    elements don't submit data. Haven't tested that last.

    Right about now we should be asking...huh?

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!

    Comment

    • rf

      #3
      Re: Is this possible?

      Rob wrote:[color=blue]
      >
      > That won't post anything if JavaScript is disabled. Why not go:
      >
      > <form name="F" method="get" onsubmit="B.dis abled=true">[/color]

      And that will post both if javascript is disabled.

      Hint: onsubmit is a javascript event handler.
      [color=blue]
      > Right about now we should be asking...huh?[/color]

      Indeed.

      --
      Cheers
      Richard.


      Comment

      • RobB

        #4
        Re: Is this possible?


        rf wrote:[color=blue]
        > Rob wrote:[color=green]
        > >
        > > That won't post anything if JavaScript is disabled. Why not go:
        > >
        > > <form name="F" method="get" onsubmit="B.dis abled=true">[/color]
        >
        > And that will post both if javascript is disabled.[/color]

        ....and the end of civilization as we know it.
        [color=blue]
        > Hint: onsubmit is a javascript event handler.[/color]

        Hint: No, actually it's an HTML event handler attribute. Which sets a
        DOM event handler property. Works with VBScript too.
        [color=blue][color=green]
        > > Right about now we should be asking...huh?[/color][/color]

        Or taking reading comprehension. I didn't say the form would be
        submitted with the desired adjustment(s) - simply that it would be
        better to have it submitted as is, than not at all. A form that submits
        via the Form.submit() method exclusively by definition eliminates a
        certain percentage of users.[color=blue]
        > Indeed.[/color]

        You betcha.
        [color=blue]
        >
        > --
        > Cheers
        > Richard.[/color]

        Comment

        Working...