Conditional Logic: Ability to disable an option in the "Single Option" field.

  • gesturepoke
    Asked on May 10, 2017 at 3:47 PM

    I downloaded the source code for one of my forms because I need to add a function that disables only one of the radio inputs when certain conditions are true.

    Under the sections named "Personalized" and "Logo," there are 2 questions that I'm trying to add this feature to. The first is a radio input question asking if the the user wants to add the message/logo, then there are dropdown menus asking about placement (chest or sleeve) followed by another radio question asking if they want it on the left or right side. I want to add a function that disables one of the radio inputs on the logo so the user can't add the logo and the message in the same exact spot.

    I made a test version in jsfiddle here. So I know the code I'm. But for some reason, nothing happens when I add the same setup to the jotform file. I've tried linking the form to a js file, and I've tried typing the script directly inline. Neither one seems to be working.

    I know with CSS I have to use the !important property a lot to get the form to do what I want. Is there some equivalent thing I need to type in jquery?

  • jonathan
    Replied on May 10, 2017 at 6:13 PM

    It will help us understand more the problem if you can share to us the URL of your website where you have used the source code of the form.

    Also, I am not sure if you have found already, but there is already an existing condition option in form Conditions that will allow enable/disable of fields base on condition rules.

    Conditional Logic: Ability to disable an option in the Single Option field Screenshot 20

    What I am saying is, you probably won't have to use the source code to achieve the condition rule needed to enable/disable a field in the form.

    You can use the CSS code to reposition the fields on the form so that when they show/hide or enabled/disabled they will appear on the position you want them on the form.

    We will wait for your updated response.

  • gesturepoke
    Replied on May 10, 2017 at 6:38 PM

    The form will eventually be posted here, but I haven't uploaded it to the site, yet. Right now, I'm testing the form locally - I just open the html file in my browser.

    I know about the enable/disable section under conditions, but I only want to disabled one of the inputs. The condition setting disables both of them - essentially disabling the entire question, and from what I found, there doesn't seem to be a setting to only disable part of it.

  • jonathan
    Replied on May 10, 2017 at 10:05 PM

     but I only want to disabled one of the inputs. The condition setting disables both of them - essentially disabling the entire question, 

    Can you describe more how it was suppose to work. Perhaps we can figure out a simpler solution for you within the capability of the Form Builder.

    I see this is your form. If we take a look at the Radio option button you described, the behavior I can say is actually similar to what it was suppose to be.

    Conditional Logic: Ability to disable an option in the Single Option field Screenshot 20

     

    I want to understand how your idea was suppose to be different from what the Radio option button work.

     

  • gesturepoke
    Replied on May 11, 2017 at 10:59 AM

    I want to prevent people from selecting the same placement (dropdown menu) and side (left/right radio buttons) for both the personalization and logo sections. So what I want is:

    - If the questions "Would you like to personalize your lab coat(s)?" and "Add line underneath logo?" are both marked "Yes"

    - The Personalization "Placement" dropdown menu is marked "Chest" and the radio field next to it is marked "Left"

    - And the Logo "Placement" dropdown is marked "Chest"

    - Then, the radio field next to the Logo's "Placement" should have "Left" disabled and "Right" selected.

    The condition in jotform would disabled both "Left" and "Right," which is not what I want. I only want to disable one of the 2 inputs, and there's no way to pick only one of them.

    The jsfiddle I linked to is a stripped down version of what I'm trying to do. In that fiddle, you can't pick the same exact choices for both boxes.

  • Kevin Support Team Lead
    Replied on May 11, 2017 at 12:31 PM

    Thank you for the additional details. 

    Unfortunately, that is not possible to achieve on JotForm, you can only disable the entire field and there is not a way to disable one option only, you could need to split your current radio buttons so conditions recognize them as different options. 

    If you want we could open a feature request for this, do note that we cannot provide an ETA or ensure this will be developed, but we would let you know as soon as we receive any update about it. 

    Let us know. 

  • gesturepoke
    Replied on May 11, 2017 at 1:00 PM

    Yeah, I figured it wasn't possible to do from within Jotform. The issue I'm really concerned about is that it's not working even after downloading the source code and using my own script. Will it not work even if I download the files and add code to it?

    I would like to put in a feature request even if it doesn't happen for a while.

  • Kevin Support Team Lead
    Replied on May 11, 2017 at 1:36 PM

    Yes, if you download the source code of your form it should work, make sure you're using the correct field's IDs or classes, make also sure that the code you are adding to your form does not conflict with the scripts the form uses, this may be why you cannot see it working. 

    I also forward this to our second level as feature request, we will let you know as soon as we get updates about it. 

  • stormingrobots
    Replied on May 17, 2017 at 8:43 AM

    to gesturepoke.   It is rather easy to do in dropdown :

    <option value="choice2" disabled>2nd choice in my dropdown</option>

    Hope this will be added feature into Jotform, as this is a rather common practice to selective disabled options in a dropdown menu.

  • Rose
    Replied on May 17, 2017 at 9:01 AM

    We have forwarded your feature request to our developers. We unfortunately cannot give you any estimates regarding when or if this might get implemented, but as soon as such a feature becomes available, we will make sure to let you know through this support thread.