Latest code & example
- August 30, 2020
- 2 replies
- 1084 views
Here is the latest code and now it is not working when I click on NO, it owuld reset the fields. NOw that is broken.
Everyone,
I followed this page for conditional editing:
Yet this dod not work for me. I created hidden text field and created the code. It is not working, then I added to the Mouse Up event on the Radio Button and still is not working.
This what I am trying to do. Also, what I will need to also figure out is iof the check NO, then I want to initialize the fields to the default value. I.E. Year = "Select a year (Default value on the List Dropdown)", the other 2 fields are spaces.
If the button is Yes,
Unprotect the 3 fields and make them required
Else
IF the button is No, then
protect the 3 fields and make them not required.
Here is my javacript code:
var vYesNo = this.getField("Trade_Yes_No_Grp").value;
var vYearCar = this.getField("Year_Drop_Down");
var vCarMake = this.getField("CMake");
var VCarModel = this.getField("CModel");
vYearCar.required = false;
vCarMake.required = false;
vCarModel.required = false;
vYearCar.protected = true;
vCarMake.protected = true;
vCarModel.protected = true;
if (vYesNo == "Yes")
{
vYearCar.required = true
vCarMake.required = true
vCarModel.required = true
vYearCar.protected = false
vCarMake.protected = false
vCarModel.protected = false;
}
else if (vYesNo == "No")
{
vYearCar.required = false
vCarMake.required = false
vCarModel.required = false
vYearCar.protected = true
vCarMake.protected = true
vCarModel.protected = true;
}
Can someone plz let me know what si wrong with this code or where I should put this java script and the even which it should happen under. Thanx in advance.
Jerry
