Submitting only CHANGED text boxes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rked@att.net

    #1

    Submitting only CHANGED text boxes

    I have an order form with about a hundred textboxes saying 0.
    People change the zero to something else to tell quantity of field.
    I am submitting page via asp and cdo.

    Is there a function that detects changed text boxes and will only have
    those submitted?

    Here is address of page.

    http://www.marioncountyfl.org/emsasupplies.htm

    I dont want all the non-ordered items showing up in submissal. Thanks!

  • RobG

    #2
    Re: Submitting only CHANGED text boxes

    rked@att.net wrote:[color=blue]
    > I have an order form with about a hundred textboxes saying 0.
    > People change the zero to something else to tell quantity of field.
    > I am submitting page via asp and cdo.
    >
    > Is there a function that detects changed text boxes and will only have
    > those submitted?
    >
    > Here is address of page.
    >
    > http://www.marioncountyfl.org/emsasupplies.htm
    >
    > I dont want all the non-ordered items showing up in submissal. Thanks!
    >[/color]

    Create an onsubmit function that disables all the text inputs that have
    a value of '0' - disabled elements are not successful and should not be
    submitted by the browser.

    Any browser with JavaScript disabled (or without javascript at all)
    will submit all the fields regardless. A sample script that will also
    disable any empty text element (value = '') is below:

    <form name="strBody" onsubmit="disab leZeros(this);" ... >
    ...
    </form>

    <script type="text/javascript">
    function disableZeros(f) {
    var els = f.elements;
    var i=0;
    var el = els[i];

    do {
    if ('text'==el.typ e && 0==el.value) el.disabled = true;
    } while ( el = els[++i] )

    }
    </script>



    --
    Rob

    Comment

    • rked@att.net

      #3
      Re: Submitting only CHANGED text boxes

      Thankyou soo much for replying. I works nicely.
      Alas, I have run into another condundrum.
      I am able to request.form value of field > 0 but is there a way to also
      write the field associated with the value submitted? Because all I get
      is a list of numbers and not the field names associted with those
      values. So instead of
      1
      2
      4
      3

      I would like

      FastPatches (Adult) - 1
      FastPatches (Pediatric) - 2
      Patient Electrodes (pack) - 4
      Pediatric Electrodes - 3

      In essence, response.write only those items that have been submitted or
      obtained via request.form... i hope this makes sense

      Comment

      • RobG

        #4
        Re: Submitting only CHANGED text boxes

        rked@att.net wrote:[color=blue]
        > Thankyou soo much for replying. I works nicely.
        > Alas, I have run into another condundrum.
        > I am able to request.form value of field > 0 but is there a way to also
        > write the field associated with the value submitted? Because all I get
        > is a list of numbers and not the field names associted with those
        > values. So instead of
        > 1
        > 2
        > 4
        > 3
        >
        > I would like
        >
        > FastPatches (Adult) - 1
        > FastPatches (Pediatric) - 2
        > Patient Electrodes (pack) - 4
        > Pediatric Electrodes - 3
        >
        > In essence, response.write only those items that have been submitted or
        > obtained via request.form... i hope this makes sense
        >[/color]

        At at guess you're talking ASP here? If so, you are more likely to get
        a suitable answer in an ASP or server scripting/programming forum.

        --
        Rob

        Comment

        • Mick White

          #5
          Re: Submitting only CHANGED text boxes

          rked@att.net wrote:
          [snip] So instead of[color=blue]
          > 1
          > 2
          > 4
          > 3
          >
          > I would like
          >
          > FastPatches (Adult) - 1
          > FastPatches (Pediatric) - 2
          > Patient Electrodes (pack) - 4
          > Pediatric Electrodes - 3
          >
          > In essence, response.write only those items that have been submitted or
          > obtained via request.form... i hope this makes sense[/color]

          In js, you're looking for:
          z= TEXTFIELDOBJECT .parentNode.pre viousSibling.fi rstChild
          while(z.firstCh ild)z=z.firstCh ild;
          description=z.d ata

          Pass this along with the qty ordered, store it in a hidden field.

          Mick

          Comment

          • Lee

            #6
            Re: Submitting only CHANGED text boxes

            rked@att.net said:[color=blue]
            >
            >Thankyou soo much for replying. I works nicely.
            >Alas, I have run into another condundrum.
            >I am able to request.form value of field > 0 but is there a way to also
            >write the field associated with the value submitted?[/color]

            It's a bad idea to make your form submission dependent on client-side
            Javascript. Massage the form data however you like on the server side
            in your ASP code.

            Comment

            • Mick White

              #7
              Re: Submitting only CHANGED text boxes

              Lee wrote:
              ....[color=blue]
              >
              > It's a bad idea to make your form submission dependent on client-side
              > Javascript. Massage the form data however you like on the server side
              > in your ASP code.
              >[/color]
              I agree that SS processing is crucial. Why not simply give form
              controls meaningful names?
              Mick

              Comment

              Working...