Expand my Community achievements bar.

SOLVED

If Radio button == "1" Then object property user entered = required

Avatar

Level 3

I would like to know if there is a way to change the user entered-required property of an object dynamically.  i want to say something like:

if(radioButton1 == "1")

{

objectPropertyRequired = "Required";

}//end if

Any help is greatly appreciated.

Justin

1 Accepted Solution

Avatar

Correct answer by
Level 10

Your code is almost correct; Just add .rawValue  after radioButton1

Your code should look like:

if(radioButton1.rawValue == "1")

{

objectRef.mandatory = "error";

}//end if

Nith

View solution in original post

3 Replies

Avatar

Former Community Member

Justin,

The attached uses a radio button group to toggle a field from/to required.

Steve

Avatar

Correct answer by
Level 10

Your code is almost correct; Just add .rawValue  after radioButton1

Your code should look like:

if(radioButton1.rawValue == "1")

{

objectRef.mandatory = "error";

}//end if

Nith

Avatar

Level 3

Thank you everyone for your input I really appreciate it!!!!!  Here is what I ended up using:

<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>

Again Thank you for everyone who submitted feedback and examples I really really appreciate it!!!

Justin