Hello,
need help with a field. the field in question is called owned_t1.
owned_t1 should show the text "YES / NO" if description_t1 has a value. otherwise owned_t1 should remain blank.
The user should then have the option to edit "YES / NO" and enter "YES" or enter "NO" any other text entry should be rejected and returrned back to "YES / NO". A message popup box would be nice if the user entered a value other then "YES" or "NO"
Can someone help me with this?
so far i have (in calculate)
if (HasValue(description_t1)) then
owned_t1 = "YES / NO"
else
owned_t1 = ""
endif
but whenever i enter any details into the field it returns back to "YES / NO" i need a way for the user to overwrite this with the values "YES" or "NO" but not allow the user to enter any other text.
to make the field accessble and readonly as you have your script which is checking the Hasvalue
by adding one line in the if case which becomes
if (HasValue(description_t1)) then
owned_t1 = "YES / NO"
owned_t1.access = "open"
else
owned_t1 = ""
owned_t1.access = "readOnly"
endif
will make the field readonly and accessible.
for the field owned_t1 write the below script in Exit Event Script Language as Javascript
if ( !(this.rawValue == null) )
{
if ( !(this.rawValue == "yes" || this.rawValue == "YES" || this.rawValue == "no" || this.rawValue == "NO") )
{
xfa.host.messageBox("please enter valid value either yes or no");
xfa.host.setFocus(form.owned_t1);
}
}
note: owned_t1 is the field name and form is the body page name in the Hierarchy tab which you give.
Thanks,
Madhu.