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

Question

Question

Modern Layout Forms: Custom button to deselect radio button?

asked on September 26

I have a table with a radio button in each row. If a user selects an option in the radio button, there isn't a way for them to clear that selection if they made a mistake. I am wondering if it would be possible to add a button to each row that, when clicked, will clear the radio button selection for that row?

Thanks!

 

0 0

Replies

replied on September 26

I gave a JS on this post: Radio Button Change - Laserfiche Answers

You could adjust that for a table.

0 0
replied on September 26

Hi Angela,

I appreciate the reply to my question, but I'm afraid I don't know what else needs to be done to get this to work in my table. 

I added the following code:

// Trigger when Field 65 changes
LFForm.onFieldChange(async () => {
  // Clear the value of Field 126
  await LFForm.setFieldValues({ fieldId: 126 }, { value: "" });
}, { fieldId: 65 });

Field 65 is a drop-down in the table with one choice called "Clear". When I tried it out by seleclting "Clear" from the drop-down, the value of field 126 did not clear.

 

0 0
replied on September 26

In your table, do you want to clear all radio buttons or just the one on the row and does it need to be a drop down or can it be a radio button to clear the other radio value?

0 0
replied on September 29

I actually might change my approach. I was originally considering having a way to clear the radio button selection on the row, either by clicking a custom button that is on the same row, or by making a selection in a drop-down on the same row.

However, after thinking this through a bit more, I am considering the following approach:

  • Have 3 choices in the radio button group ("Change", "Cancel", and "No Change"). This is for a table that shows the user their previous leave requests, and allows them to either change or cancel the request. The "No Change" option will be used if they decide that they are not changing a request.
  • All fields in the table, except the radio button group, will start off as read-only. When the user clicks Change, then certain fields will be editable (The Cancel and No Change options will have no effect on fields).

 

I think I will close this question and post a new one for the updated requirements.

 

Thank you!

 

0 0
replied on September 29

That sounds like a simple approach now that I understand more of what you are wanting to achieve.  I was able to get a JS working that would clear the radio buttons based on a checkbox field being checked or unchecked, however I couldn't get it to index properly so that the checkbox on the same row clears only the radio button on that row.  

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

Sign in to reply to this post.