Expand my Community achievements bar.

Script Help - CONDITIONAL -

Avatar

Former Community Member
hello, I have a problem because I'd like to put a conditional sentence:

"if "TEXT FIELD NO1" = "MARK ANTHONY" then "TEXT FIELD NO2" = "43555668D"

I've got a "drop down list" and I want to set a value if a text field says something or a different value if the text field says something different.

How can I do this??



thanks

regards
5 Replies

Avatar

Former Community Member
I will use Javascript for my example. On the exit event of textField1 you could use code something like this:



if (this.rawValue == "MARK ANTHONY") {

TextField2.rawValue = "43555668D"

} else {

TextField2.rawValue = ""

}

Avatar

Former Community Member
THX, it worked for me even with FormCalc. I was wrong because I used = instad of ==

Avatar

Former Community Member

Hi All,

I have an small issue with respect to reading XML Datasource node. Initially I had done the same thing using the Dropdown list box change event by using the below code:

-------

var stateDataNode = $record.resolveNode("StatesAndCities.SAPDetails.(SAPCode.value == " + this.boundItem(xfa.event.change) + ")");

-------

Now I have requirement as the selecting the nodes from same XML Datasource based on the value entered in the TextField. So, I am using the below code in the 'Exit' event of the TextField to accomplish but it's not working. I am using this code in FormCalc :

-------

var stateDataNode = $record.resolveNode("StatesAndCities.SAPDetails.(SAPCode.value == " + this.rawValue + ")");
-------

Using the this.rawValue I am able to read the value in MessageBox, but not in the above code.

So, I am looking for the further help you guys. Please help regarding this.

Regards!

Sree Harshavardhana

Avatar

Level 4

I believe you need to use the dropdown's newText or some property like that in order to access it's new value.  this.rawValue on a Change event will get you what it previously was...to use rawValue, you could put the code in the exit event instead of the change event, or as I stated previously, using the newText attribute

Avatar

Former Community Member

Dear AK,

Thanks!

As you said, I have my code with in the Exit event of the TextField itself and even I tried to use the newText property of the TextField but no luck!!!

Any other thoughts?

Regards.