cancel
Showing results for 
Search instead for 
Did you mean: 

mandatory field property in dependence of another field value

Former Member
0 Kudos

Hi all,

i have the following problem:

I have a dropdown and a textfield in one interactive form. The text field is not a mandatory field.

The DD have the values: "1-Yes" and "2-No"

If the user select value "2-No" the text field must be changed to a mandatory field (object->type->user entered - Required).

I think I have to implement a javascript event in the lifecycle designer...

but I don't know how to do that.....

a piece of code would be great...

thanks to everybody ahead....

regards

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

i solved the problem with this simple coding. It is important to use the LifeCycleDesigner 8.x.

exit()

function exit() {

if (this.rawValue == 'Yes') {

TextField2.presence = "invisible";

}else{

TextField2.presence = "visible";

}

}

Reema, thanks for answers....

former_member189058
Active Contributor
0 Kudos

Hi,

Try this code in formCalc in the Exit event of the text field.


var v_txt = xfa.form.form1....textfield_name.rawValue
var v_dd = xfa.form.form1...dropdown_name.rawValue

if (v_dd == "YES" & v_txt == "") then
  xfa.host.messageBox("Please Enter Textfield")
  xfa.host.setFocus(this.somExpression)
endif

Regards,

Reema

former_member189058
Active Contributor
0 Kudos

Hi Markus,

The solution that I provided will not let the user click or tab out of the field without having the value entered.

Another thing that you may do is write the same code in the preSave and docClose events so that the message is displayed even before saving or closing the form.

Reema.

Hope this helps you. Pl post back or close the thread if your problem is solved.