required = "false"; Not working JavaScript

Hello,

In my document I have groups of radio buttons and depending on selections depends on whether text fields are shown visible and required.

Inside the buttons I run individual scripts, the only real difference between them are the actions taken if the conditions are met;
--within the CustomValue button--
var fldValue = this.getField("ItemValues").value;
if (fldValue == "CustomValue"){
 this.getField("ValueTxt").display = display.visible;
 this.getField("WeightTxt").display = display.visible;
 this.getField("ValueTxt").required = "true";
 this.getField("WeightTxt").required = "true";
}
^ this part works fine.
--within any other button--
var fldValue = this.getField("ItemValues").value;
if (fldValue !== "CustomValue"){
 this.getField("ValueTxt").display = display.hidden;
 this.getField("WeightTxt").display = display.hidden;
 this.getField("ValueTxt").required = "false";
 this.getField("WeightTxt").required = "false";
}
^ this part sets the fields to hidden no problem, it does not however set the field to not required.
I have also commented out the hidden scrips to see if it was simply because the button was hidden but it still remains required.
As a half measure I have set the border colour to turn red then black instead of required and not but for full functionality I would like them to be required and not. I don't quite know why it is not functioning properly as 'usually' this method works for me.

As always any help is appreciated
Thank you in advance


Alex Horsfield


Voted Best Answer

Okay I solved it, I have put "" around the true and false statements. Removing them has worked... *Facepalm*


By Alex Horsfield   


Please specify a reason: