Skip to main content
individualistic_Swirl5D2F
Known Participant
Nov 13, 2020 11:08 AM UTC
Answered

Required field activates after click on radio button?

Hello,
next question,

I've two radio buttons in one group
[   ] as of now or [  ] due date        also some seperate fields for day, month and year as  [M][M][D][D][Y][Y]

 

Is there a possibility, if you click on the "as of due date" button, that all text fields for the date are activated (writable + required)?

If the "writeable first" does not work, it would be good to know how to make it then a required field.

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Dec 1, 2020 9:21 AM UTC

Add this to the code:

this.getField("Tag").value = "";
this.getField("Monat").value = "";
this.getField("Jahr").value = "";


Not sure why that's not working, but you can use this code to reset those fields to their default values:

this.resetForm(["Tag", "Monat", "Jahr"]);

14 replies

Nesa Nurani
Community Expert
Community Expert
Nov 16, 2020 11:35 AM UTC

You can use this code in one of the radio buttons to make fields writable and required
if you want them to be readonly and not required use same code in second radio button
just change true-false, false-true:
this.getField("Tag").required = true;
this.getField("Tag").readonly = false;
this.getField("Monat").required = true;
this.getField("Monat").readonly = false;
this.getField("Jahr").required = true;
this.getField("Jahr").readonly = false;

Translate
individualistic_Swirl5D2F
Known Participant
Nov 16, 2020 2:11 PM UTC

Thank you, this works almostly. But if I click on the 2nd radio button with this required code. And going back to the first radio button, the textfield are still required.

Translate
Nesa Nurani
Community Expert
Community Expert
Nov 16, 2020 2:37 PM UTC

In second button change every "true" to "false" and "false" to "true":

 

Translate
try67
Community Expert
Community Expert
Nov 13, 2020 12:41 PM UTC

Yes, that's possible. What are the names of the fields and the export values of the radio-button group?

Translate
individualistic_Swirl5D2F
Known Participant
Nov 16, 2020 6:25 AM UTC

group name = gilt
radio button 1 = ab sofort

radio button 2 = ab fälligkeit

 

3x textfields called:

- Tag

- Monat

- Jahr

Translate