3 Radio, 2 Checkbox - 1 Variable Form Javascript Form

Discussion in 'JavaScript' started by SH77, Mar 20, 2007.

  1. #1
    Im trying to make a form that will submit different orders to paypal based on 3 radio options and 2 check boxes. I am passing one variable to paypal that may have 12 different values. How can I do this without having 12 radio options? Is javascript the only way? If javascript is disabled could the form default to one of the values?
     
    SH77, Mar 20, 2007 IP
  2. cjburkha

    cjburkha Peon

    Messages:
    71
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You probably need to post a bit more of your situation.

    BUT, if the values of the paypal variable are simple 0-11, then you should be able to do it with 4 checkboxes and some math and javascript.

    ( ) - ( ) - ( ) - ( ) = 0
    (.) - ( ) - ( ) - ( ) = 1
    .
    .
    .

    (.) - (.) - (.) - (.) = 12
     
    cjburkha, Mar 20, 2007 IP
  3. SH77

    SH77 Guest

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    For example:

    <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_s-xclick">
    <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIuKnnLuQ==-----END PKCS7-----">

    Input "encrypted" needs to change based on the form:

    () Red Sweater (radio) default selected
    () Green Sweater (radio)
    () Blue Sweater (radio)
    [] Add a hat (checkbox1) default checked
    [] Add socks (checkbox2)

    [submit button]
     
    SH77, Mar 20, 2007 IP
  4. cjburkha

    cjburkha Peon

    Messages:
    71
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Meh, I cant post at work, so I'm slow to reply....


    What are the 12 values for "encrypted"?
     
    cjburkha, Mar 21, 2007 IP
  5. SH77

    SH77 Guest

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks for trying to help. I did get this to work using javascript. Anyway heres the code if anyone is interested.

    http://freedomsforums.com/javascript-form-3-radios-2-checkbox-pass-1-hidden-variable-t151.html
     
    SH77, Mar 23, 2007 IP