Important Update: Archer Community Scheduled Maintenance on November 23–24 - New Community Launching Soon! Learn More..
2023-07-11 11:38 AM
I'm trying to create a custom object that will trigger on a change to the contents of a text (not text area) field. The goal is to display a warning when the contents of the text field do not match a specific format. I can get the function to fire based on other field types (like a date/time field or a dropdown values list field) but can't get it to trigger based on a change to a text field.
The code below shows what I'm trying to do. The validation function is just a simplified example. The first event handler is triggered by a change in a date/time field and is just there to verify a successful call to the validator. It works but is not what we are looking for. The second handler is an attempt to be a trigger of a change in a text field. That's what we really want, but it is not working.
Any help is appreciated.
2023-07-11 01:51 PM
@JeffLamb1 try, just update the field id (23319).
<script>
Sys.Application.add_load(function() {
$('#master_DefaultContent_rts_s8352_f23319c').blur(function() {
//do something
});
});
</script>
Advisory Consultant
2023-07-11 01:59 PM
I will try that. One question first; what does the s8352 represent? When I inspect my field, I see a different number after s.
2023-07-11 02:21 PM
Not sure, but check if this is still valid: Custom Objects using Regular Expressions.zip - Archer Community - 522308 (archerirm.community)
2023-07-11 02:45 PM
@JeffLamb1 sorry, meant that needs updated as well.
Or go wit this approach, The Horror's of Moving Custom Objects from One Environment to Another - Archer Community - 569029 (archerirm.community)
Advisory Consultant
2023-07-14 12:30 PM
That event handler works, so thank you!
One additional minor question. If my validator returns false, is there an easy way to make the focus return to the text field after the user clicks OK on the warning message?
2023-07-14 12:36 PM
: D
You could use (jQuery) .focus() on that element.
Advisory Consultant
2023-07-14 03:53 PM
Sorry, would the syntax on that be this?
$('#master_DefaultContent_rts_s8352_f23319c').focus();
2023-07-14 03:58 PM
That should do the trick ; )
Advisory Consultant
2023-07-14 04:14 PM
When I do that, it whites-out the entire record page. Just keeps the Warning dialog box displayed over a white page. And won't let me close the dialog box either.
$('#master_DefaultContent_rts_s8352_f23319c').blur(function() {
if isInvalid(23319)) {
WarningAlert(WarningMsg,'Invalid');
$('#master_DefaultContent_rts_s8352_f23319c').focus();
}
});