Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Check mark option to change read only values

Avatar

Level 1

Basically I am trying to implement javascript or formcalc to perform the following function...

When you check the highcost_Yes check box the value in field charge1 changes to 10, with no check in the highcost_Yes field the value of charge1 should be 8.

I have the default value for the charge1 field set to 8 as well if that may be causing me issues.

check box highcost_Yes (values set to 1 or 0)

This is the javascript snippit I tried:

if (highcost_Yes.rawValue ==1)

{

charge1 == 10

}else{

charge1 == 8

}

After some reaserch I tried this formcalc code:

if(highcost_Yes.rawValue == 1)then
(charge1==10)

elseif (charge1==8)
endif

I have been learning javascript this term in school so while I understand the concept I am far from practicing it efficiently.


Can anyone tell me where I went wrong?  Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 3

Sorry - no double == when setting the value:

if (highcost_Yes.rawValue == 1)

{

     charge1.rawValue = 10;

}

else

{

     charge1.rawValue = 8;

}

View solution in original post

4 Replies

Avatar

Level 3

Hi -

You need to add .rawValue to the code to set a value:

if (highcost_Yes.rawValue ==1)

{

     charge1.rawValue == 10;

}

else

{

     charge1.rawValue == 8;

}

Avatar

Correct answer by
Level 3

Sorry - no double == when setting the value:

if (highcost_Yes.rawValue == 1)

{

     charge1.rawValue = 10;

}

else

{

     charge1.rawValue = 8;

}

Avatar

Level 1

You are AWESOME!!

I absolutely love this community and the response times. Thanks so much for your assistance, I would give you 50 points if I could

Avatar

Level 3

No prob!  I have received a bunch of help here for my forms.  It is a great place!