Assign Default value to radion button.

Hi all,

I have a radio button field, it should have a default value 'no' ,

If user clicks yes, it saves "Y" in CDT column, but on interface part it again changes to its default (No) value. I need to save 'N' as a default value too in CDT column. If user clicks, yes ."Y' should be saved in cdt column.

a!radioButtonField(
label: "Relevant?",
labelPosition: "ABOVE",
choiceLabels: {
"Yes",
"No"
},
choiceValues: {
"Y",
"N"
},
value: "N",
saveInto: local!CourseCDT.relevantind,
choiceLayout: "COMPACT",

)

By Default , it shows No value, which is right. But as soon as user clicks yes, It again changes to no. I want to show No as a default value and it should also get saved in CDT column. If user clicks yes, It should stays at yes radio field.

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Lead Developer

    Your trouble is that you have value "N".

    That means that the value is "N".  It's always "N".  That's a constant.  Your saveInto is built to always save "N" to the local!CourseCDT.relevantind.

    You should set the value to local!CourseCDT.relavantind.  Now, when you change the local! it will show up in the radio button. 

    Next, make sure that the definition of local!CourseCDT.relavantind always sets it to "N".  The definition only runs once when the form is loaded, so it only sets the local! to "N" one time, then your radio button will overwrite the value as you interact with it.

Reply
  • +1
    Certified Lead Developer

    Your trouble is that you have value "N".

    That means that the value is "N".  It's always "N".  That's a constant.  Your saveInto is built to always save "N" to the local!CourseCDT.relevantind.

    You should set the value to local!CourseCDT.relavantind.  Now, when you change the local! it will show up in the radio button. 

    Next, make sure that the definition of local!CourseCDT.relavantind always sets it to "N".  The definition only runs once when the form is loaded, so it only sets the local! to "N" one time, then your radio button will overwrite the value as you interact with it.

Children
No Data