You are viewing limited content. For full access, please sign in.

Question

Question

Disable Specific Radio Option Only

asked on April 26 Show version history

Hi, I'm in the New Forms 11 design. I have a radio button with four options. They are Cash, Check, Money Order and Epay.  For my values I have Cash, Check, MO and EP. I would only like to disable the "Check" option. The disable feature works but I can't seem to target ONLY the Check option. Can someone tell what I'm missing. Here is my js code.

LFForm.disableFields({fieldId: 1, value: "Check"});
 

Radio Button 1.png
Radio Button 2.png
Radio Button 3.png
0 0

Replies

replied on April 26 Show version history

I do not believe that specific choices on a checkbox or radio button field can be disabled, just the overall field.  I believe this is the case both with disabling via Field Rules and disabling via the LFForm Javascript functionality.

I have a form where I needed functionality like this to selectively disable one of four checkboxes, and I ended up just making them four different fields, so that I could use Field Rules to disable/enable the individual ones as needed.  I left the labels blank on the four checkboxes (and did a single label before them via a Custom HTML element instead).  I gave the Custom HTML element and each of the checkboxes the CSS Class of multiCheckbox, and used the following CSS to get them closer together, so even though they are multiple fields, they look line a single field.

/*Modify the margin/padding above and below the multiCheckbox fields.*/
.multiCheckbox .checkbox { padding-top: 0px!important; padding-bottom: 0px!important; }
.multiCheckbox .custom-html { padding-top: 0px!important; padding-bottom: 0px!important; }
.multiCheckbox .checkbox label { padding-top: 0px!important; padding-bottom: 0px!important; }

 

This works well with a checkbox that isn't required (0 to many).  It gets harder if you want it to behave as a radio button (0 to 1) or when you want it to be required (1 to many).  But there are ways you can get around that using Javascript or Field Rules.

0 0
replied on April 27

Very creative!!! thanks for the ideal.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.