Expand my Community achievements bar.

troble with if statement

Avatar

Level 1

I have a forrm with a

dropdown that control the the mandatory property of itsel and a text box

.  It does not seem to be working

F.P@.DropDownList2::Exit

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

this.mandatory="error";

}

else {

this.manfdatory="disabled";

}

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

F2.P2.TextField13.mandatory="error";

}

else {

F2.P2.TextField13.mandatory="disabled";

}

the value type of each field is user enter-required.  when i select no from the dropdownlist2 ,i'm trying to change the field type of both fields to not required. is mandatory the same as User Entered-required?

8 Replies

Avatar

Former Community Member

Mandatory is a but confusing. Try....

// form1.page1.subform1.dd::exit - (JavaScript, client)

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

  this.validate.nullTest = "error";

  form1.page1.subform1.tf.validate.nullTest = "error";

}

else {

  this.validate.nullTest = "";

  form1.page1.subform1.tf.validate.nullTest = "";

}

Steve

Avatar

Level 1

i place the code in the exit of the DDlist and i still got hte error msg that i had field with missing data whem i selected no from the dropdown and enter nothing in the test field

Avatar

Former Community Member

Can you forward the form to stwalker.adobe@gmail.com?

Steve

Avatar

Level 1

I inserted your code in F.P2.DropDownList2 and I am trying to control this field and the text field (F.P2.TextField13) below it so that the text field is only required when the user selects yes from the drop down list

Avatar

Level 1

when I make the text field user-entered-required and select NO from the dropdown and do not enter text I still get the error msg that required fields are not filled in. When I make the text field optional and select Yes from the dropdown, and do not enter anything in the text the email is sent. This is the opposite of what I desire to happen

Avatar

Level 1

it look like it is related to the type of button I'm using. I'm using a regular button to submit the completed form to a email address the code works when I insert your submit button. is there anything I can do to make it work with the email below is the code I have with the button

Avatar

Level 1

it also works when I use a submit email button , however this only submits the data file and not the completed file