How to disable a radio button when a user starts typing into another field

I’m looking for help in disabling a radio button as soon as the user enters a value into a currency field.

I have a conditional form where fields appear once a value has been entered in the previous field. The fields consist of a currency field and a radio button and form part of a mortgage application.

The user can enter a value, such as how much their property is worth, in the currency field, or they can select a radio button that says “I don’t know”. They then move on to further questions like How much do you currently owe? with an “I don’t know” radio button. I want to hide each radio button by default and then only show it when that section is due to appear and the the user hasn’t entered any value in the currency field. As soon as they enter a value I want to hide the radio button.

Can anyone help me achieve this. I am a complete beginner with JQuery/Javascript and having looked at the documentation for Gravity forms it looks like the gform_input_change function is what I need, I just don’t know how to go about coding what I want to acheive.

Any help is greatly appreciated. I have inherited this work from another developer who has been placed on Furlough during the lockdown period.

You can set a conditional logic rule on the radio button fields to HIDE them when the previous field IS NOT and then leave the value input blank. That will be evaluated as “hide this field when the previous field has ANY data entered into it.”

Will that work for you?

Hi Chris,

I tried that and it works perfectly on the first currency/radio button field. The problem arises when the next currency/radio button field is then shown. The logic for the next field set is to show after either the first currency field has a value or the first radio button is checked.

The logic then says show both the next currency field and it’s accompanying radio button. As I already have conditional logic to show the next radio button, I can’t then turn it off when a user yenters a value into the 2nd currency field.

Here’s a link to the site so you can see the issue http://ycdev.co.uk/simple/remortgaging-form/

Can you export the form and send the JSON file to chris@rocketgenius.com?

Here’s how to export a form:

Hello Chris,

I have exported the form as a JSON file and sent an email to you this morning with it attached.

I took a look at your form. It looks like the Checkbox fields for “I don’t know” need to be hidden with conditional logic that says HIDE “If the field above ISNOT” and then leave the input empty. When someone enters a value in the input, the checkbox is hidden. If they back up and remove the value, the checkbox is shown again. That worked for me all the way down the form. The form you sent me did not have that conditional logic applied. Can you try that?

It seems like your rules are more complex than that though For example, you need combined conditional logic. Some questions are going to additionally be hidden because they are not relevant.

I recommend starting over an putting each pair of questions in a section, so you can hide both questions in the section if it’s not relevant, or, using a multi-page form, and using the page conditional logic to hide a complete page. It seems to be a pretty complex application, so I would start over and test each field, section or page as you go to ensure it’s working as expected as you build it.

Hi Chris,

I’ve tried to follow your recommendation, but I can’t get it to work.
The fields have to appear in pairs as you fill in the preceding questions. That’s the issue, the client doesn’t want to show all of the fields at once. They want each question and its corresponding “I don’t know” field to be shown after the previous field or it’s "I don’t know’ checkbox is checked, that’s why I was wondering if there’s a javascript way around it, i.e. when the first text field gets a value typed in, the corresponding “I don’t know” is hidden.

They also don’t want to split the form into separate pages. I have asked that question already :confused:

© 2008 - 2019. Gravity Forms is a project by Rocketgenius Inc.