How to require customer to deselect option if they change radio field answer to no.

  • daveprenter
    Asked on April 14, 2014 at 7:31 PM

    Hi there,

    I have a radio button field in my form with the answers yes or no. If they select yes, then using conditions and hidden fields another radio button field appears with 3 product choices. If they choose any of these the price of that product gets added into the total.  My problem is that if the customer  selects one of these 3 products, but changes their mind and goes back and selects "No" on the original radio field, the price of the selected item still remains in the total.  However,  the product radio field is now hidden again which is obviously not a good outcome since the customer is probably not aware that he has not deselected that item.

    So if the customer still has selected items and then selects "no", how to require them to deselect those items BEFORE selecting "No". 

     

    I am referring to the "transfers" field on my form.

  • Elton Support Team Lead
    Replied on April 14, 2014 at 9:54 PM

    Hi,

    Sorry but I found no way to do this in the form builder. However, this is possible when you take your form source code and add script that would clear the fields once the user selects "no" on the radio button field.

    If you want to go on this route, let us know here and we'd be happy to provide you the custom script in order to achieve this function.

    Thanks!

  • daveprenter
    Replied on April 15, 2014 at 3:00 AM
    Hi EltonChris,
    Thank you for your kind reply, yes let's go down that route. So I have simplified the form a bit so that there is only the one radio button (#input_183_0, #input_183_1, ) . If this is selected as "No" then all the fields re transfers to be cleared (Basically everything between the Form Collapse "Begin transfers" and Form Collapse "End transfers" including of course the values of any transfers they have selected that otherwise would be added on to the totals.
    Let me know if that is not clear,
    Kind Regards,
    Dave Prenter
    --------------------------------------------
    ...
  • Ashwin JotForm Support
    Replied on April 15, 2014 at 4:16 AM

    Hello Dave,

    Thank you for your confirmation.

    Unfortunately my colleague is not available online currently but your message has reached him. I will also take a look at your form and try to come up with the custom code to achieve your requirement. Anyway, one of us will get back to you soon.

    Thank you!

  • daveprenter
    Replied on April 15, 2014 at 6:40 AM
    Ok, thank you very much . I appreciate everything yoiu guys do.
    dave
    --------------------------------------------
    ...
  • daveprenter
    Replied on April 17, 2014 at 5:30 AM
    Hi there guys,
    Happy Easter to you all.
    Just wondering if there is any progress on this?
    Kind Regards,
    Dave
    --------------------------------------------
    ...
  • Elton Support Team Lead
    Replied on April 17, 2014 at 6:58 AM

    @daveprenter

    Happy Easter to you too! :)

    I am truly sorry for the delay. I will provide you the script later today, probably in the next 2 hours. Please stay tuned for the updates!

    Regards!

  • Elton Support Team Lead
    Replied on April 17, 2014 at 11:58 AM

    Here's the script. http://pastebin.com/raw.php?i=sWJQq3dT

    Just take your form source code and place this script under it (after the ending tag </form>).

    Unfortunately, I couldn't get the calculations to auto-update once these fields are cleared. I have no idea on how to place the calculation callback function on the script. However, when the user inputs again on any of the calculation fields, the changes should reflect on the calculation fields excluding the cleared field values.

    Let me know if you need anything else. Regards!

  • daveprenter
    Replied on April 17, 2014 at 7:40 PM
    Hi EltonChris,
    Thanks very much for that. I appreciate you spending the time. It is a pity that the calculations won't auto update as that is what I really wanted. I have tried something that seems to work . I duplicated the package totals field, modified it to not include any of the transfers. Then added conditions alongs the lines "If transfers equals no, then show "no transfer version of totals." If transfers field equals yes show original totals (which includes the transfer values).
    Seems to be working , need to repeat it for all the other totals, then check it for bugs. If you have any other ideas that might work better please let me know.
    Kind Regards,
    Dave
    --------------------------------------------
    ...
  • Cesar
    Replied on April 17, 2014 at 8:43 PM

    Thank for the input Dave, it is great to see you have found a very creative workaround for your issue. Unfortunately my colleague is not here at this time. Nevertheless, I would suggest to perform the replication of the condition to the other totals. Do let us know if you hit any snags during the bug testing. So that we may assist you further. Thank you.