1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Hide submit button unless specific drop down selected

Discussion in 'PHP' started by bellcom, Jan 22, 2014.

  1. #1
    I use gravity forms and you can easily add conditional logic to your submit button so it is not available unless specific conditions are met.

    I have an older form that I created with phpformgenerator online.
    Would it be easy to hide the submit button or show an error message based on the selection made from a drop down select box?

    Its for a firewood delivery form, they have to order at least 1/2 cord or wood before delivery is available. They can deliver 1/8 of one type of wood and 1/8 of another type, but the total has to equal 1/2 cord. Not sure the best way to do this but I put a question on the form asking if they ordered 1/2 or more cords of wood and stated that 1/2 cord is required for delivery.

    They still don't pay attention and try to order 1/8 cord for delivery.
    http://paulbunyansfirewood.com/order-online/
    SEMrush
    Any suggestions appreciated :)
     
    bellcom, Jan 22, 2014 IP
    SEMrush
  2. Boogy

    Boogy Active Member

    Messages:
    36
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    73
    #2
    Yes, there is a way to affect CSS with javascript. Do you know JS?

    You can call a JS function for an event on the drop down. Using selected.Index you can determine which option was selected and then set the display of the button to hide.
     
    Boogy, Jan 22, 2014 IP
  3. bellcom

    bellcom Active Member

    Messages:
    178
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    70
    #3
    No I don't know JS but I will google "selected.Index" and see if I can figure it out.

    So I could set the css for the button to
    display: none;
    then when a specific selection was made from the drop down I could change the css to something like
    display: block !important;
    ?

    thanks!!
     
    bellcom, Jan 22, 2014 IP
  4. Boogy

    Boogy Active Member

    Messages:
    36
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    73
    #4
    Let me know if you need help with it
     
    Boogy, Jan 22, 2014 IP
  5. bellcom

    bellcom Active Member

    Messages:
    178
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    70
    #5
    Yes I could use some help with this if you have time?
     
    bellcom, Jan 22, 2014 IP
  6. waterwalker

    waterwalker Greenhorn

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #6
    According to me you can use javascript to solver this problem you can enable or disable button as per selection of the dropdown list using client side script like javascript
     
    waterwalker, Jan 25, 2014 IP