Expand my Community achievements bar.

Update/Refresh Form

Avatar

Level 3

Good Afternoon Everyone!!!!!!

I have a question that is probably pretty simple I am guessing  i am using the following code if a user selects yes from the radio button options "yes" or "no" and yes = 1 which makes other fields required and no = 2  and those fields are no longer required.

<event activity="click" name="event__click">

<script contentType="application/x-javascript">

if (RadioLocation.rawValue == "1") {

if (DropDownList2.isNull) {

DropDownList2.mandatory = "error";

}

}

if (RadioLocation.rawValue == "1") {

if (TextField23.isNull) {

TextField23.mandatory = "error";

}

}

</script>

</event>

Also, I am using the following if a user selects "no" from the radio button list:

<event activity="click" name="event__click">

<

script contentType="application/x-javascript">

if (RadioLocation.rawValue == "2") {

DropDownList2.mandatory = "";

TextField23.mandatory = "";

xfa.host.resetData(DropDownList2);

xfa.host.resetData("TextField23");

}

 

 

</

script>

</

event>

My only issue is this.  If a user selects Yes then changes their mind and selects No the red box around the odject doesn't go away and stays there.  If I try to email the form the object isn't required anymore and the red box goes away so I'm wondering how we can make  this happen in real time or create an event to update the form when a user makes that change.

Justin

4 Replies

Avatar

Level 10

DropDownList2.mandatory = "";

TextField23.mandatory = "";

Does the above scripts really working??

Actually the script is suppose to be

DropDownList2.mandatory = "disabled";

TextField23.mandatory = " disabled";

Nith

Avatar

Level 3

Hello Nith,

Yes the code works great and has been very helpful.  The only piece of the puzzle I am missing now is the update/refresh script I would like to write to make the form update after someone changes their mind on an option so the required red box goes away.

Avatar

Level 10

Could you post your form for a review?

Nith

Avatar

Level 3

Greetings Nith,

Here is the form and now I am running into another problem.  I still need to figure out how to update the form with a script but more importantly I want the following code to work but for the life of me can't get it to run at all.  I am basically wanting to take the total of the rent and divide it by the sqft numeric field and place the result into the psf numeric field but for the life of me I can't figure out how to do this.  I have been trying the follwing to see if I can't get it to work:


if (NumericField13.isNull || NumericField13.rawValue == 0)

{

NumericField28.rawValue = "0"   

}elseif(NumericField27.isNull || NumericField27.rawValue == 0){

NumericField28.rawValue = "0"

}else{

     NumericField28.rawValue = NumericField13.rawValue / NumericField27.rawValue;

}

I have no idea what i am doing wrong and would love any advice or recommendations you may have as this division issue has been very frustrating as I've never had this many issues trying to divide two numbers programmatically.

Justin