Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Script needed for radio button/date field

Avatar

Level 1

Hi,

I am currently using Adobe Lifecycle Designer ES.  I have a form that has two radio buttons (each dependent on the other).  One of the radio buttons, if checked, has a date field that I would like to make required to be completed if this particular radio button is choosen.  I would assume this could be done by an "if" statement, but I'm not very good at code and was wondering if someone can assist?  Thanks.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

I have an example here: http://assure.ly/hxHupW.

You can change the mandatory property using script.

To make a field mandatory you set the property to "error". Whereas to make a field optional you set the property to "disabled".

If we take that the radiobutton value that you want to use to set the datefield to mandatory is "1", then the following JavaScript in the click event of the radiobutton exclusion group:

if (this.rawValue == 1)

{

     datefield.mandatory = "error";

}

else

{

     datefield.mandatory = "disabled";

}

Hope that helps,

Niall

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,

I have an example here: http://assure.ly/hxHupW.

You can change the mandatory property using script.

To make a field mandatory you set the property to "error". Whereas to make a field optional you set the property to "disabled".

If we take that the radiobutton value that you want to use to set the datefield to mandatory is "1", then the following JavaScript in the click event of the radiobutton exclusion group:

if (this.rawValue == 1)

{

     datefield.mandatory = "error";

}

else

{

     datefield.mandatory = "disabled";

}

Hope that helps,

Niall

Avatar

Level 1

Hi Niall,

Thanks so much for the code.  Worked perfectly!