


I am not 100% sure if this is possible. I have a field which auto populates from a choice made in a drop down menu. There are multiple values of "Nullxxx" (Null001, Null002, Null003, etc.), plus other values. I am looking to have this field value change to "N/A" rather than the value of Nullxxx, anytime it sees "Null". If it doesn't see Null, then I want the value to stay as it is imported.
So I would assume something like, If the field value contains "Null", then change to N/A, Else do nothing. I am just not sure if a field value on an auto populated field is possible to change on the fly?
Thanks, Gary
Views
Replies
Sign in to like this content
Total Likes
Try putting this in the ready:form event of your field:
if (/^null/i.test(this.rawValue))
this.rawValue=null;
Kyle
Added start of string meta-character to regular expression just in case user puts string "null" in text somewhere.
Views
Replies
Sign in to like this content
Total Likes
That didn't do anything. Plus, since the field is empty until populated from the drop-down, wouldn't it need to go into the Change event? And the null values are all Null (the word not the expression) with 3 numbers (Null###). So it needs to test/search for the word "Null" and replace with N/A if it exists. If not I need the value to populate as-is, not be empty/null.
Views
Replies
Sign in to like this content
Total Likes
Sorry, I misunderstood. I thought it was data being imported into a field whose values could be Null###.
Will the values in the dropdown be dynamic properties (ie populated at run-time)? Do you want all the values in the dropdown to change from Null### to N/A or just when the user selects Null###?
If it's the latter, put this in the change event:
if (/^null/i.test(xfa.event.newText))
xfa.event.change="N/A";
Kyle
Views
Replies
Sign in to like this content
Total Likes
Kyle,
There are three values in the drop-down that are comma delimited in the binding tab. The text chosen (Null### is never a choice, just a value) will split those values to populate three different fields. The auto populated field in question can have a value of Null###. But there are also values in that field that will not be Null### as a value. So when a value of Null### does populate the field, it would need to change to N/A. If it is a value that is not Null###, it will need to populate as-is.
So there are two things that need to happen:
I hope that is more clear? I am adding a couple of screen shots to help.
Null### value
Not Null### value
Gary
Views
Replies
Sign in to like this content
Total Likes
You can use something like this:
if (/^null/i.test(CircuitValue))
Circuit.rawValue="N/A";
else
Circuit.rawValue=CircuitValue;
Since I don't know what your code looks like to split the values, the code above assumes the variable CircuitValue is what is meant to be put in your Circuit # field.
As you can see from my previous posts though, /^null/i.test(yourstringhere) is the underlying condition that tests whether yourstringhere starts with 'null'.
Kyle
Views
Replies
Sign in to like this content
Total Likes