Trying to set up some scripting on the Formatted Text Field to change the border style from red to black when the Text meet the Regex pattern or the committed text.
Under Scripting and Parameter Change I’ve tried the bottom two methods utilizing an custom boolean property ‘validity’ that is linked to the styles desired. The bottom similar method was used in a normal Text field and was working but the Formatted Text Field is not updating the custom property value when the match condition is met.
-
Matching commit text to field text
import re
if event.propertyName == ‘text’:
pattern = event.source.validationPattern
text = event.source.text
commit = event.source.committedValue
match = re.match(commit, text)if match is not None:
event.source.validity = True
elif match is None:
event.source.validity = False -
Matching regex pattern to field text
import re
if event.propertyName == ‘text’:
pattern = event.source.validationPattern
text = event.source.text
commit = event.source.committedValue
match = re.match(pattern, text)if match is not None:
event.source.validity = True
elif match is None:
event.source.validity = False
Thanks for the help