Skip to main content
Known Participant
August 17, 2020
Answered

Pop Up with yes/no question AFTER a text field has reached its character limit

  • August 17, 2020
  • 1 reply
  • 1832 views

Hello,

I am pretty sure this is some intensive code so apologies in advance.  I am trying to have a pop-up appear with a yes/no question after a text field has reached its max character limit; depending on how the question is answered, I'll also need to set the focus to another text field.  

 

For example: I'll have the user fill in a Zip Code.  Immediatley after that, I want a pop-up to appear that asks if the user has a different mailing address.  If the user selects yes, there is a readied field (outside of the pop-up)  that I would like the focus to go to titled: Street Address.  If the user selects no, I would like the focus to go to a field titled: Agent ID.

This topic has been closed for replies.
Correct answer try67

Change the first line to:

if (AFMergeChange(event).length==event.target.charLimit) {

The code will "disappear" after you enter it, but will still work.

However, when the dialog appears the last character entered will not be visible. I have yet to find a way around that...

1 reply

try67
Community Expert
Community Expert
August 17, 2020

You can use this code as the field's custom Keystroke script:

 

 

if (event.fieldFull) {
	if (app.alert("Do you have a different mailing address?",2,2)==4) this.getField("Street Address").setFocus();
	else this.getField("Agent ID").setFocus();
}

 

Known Participant
August 17, 2020

That is exactly what I want to happen!  Thank you!  The only issue is that it doesn't pop-up when the Zip Code field is filled, only if you try to exceed it.  Any solutions for that?

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
August 17, 2020

Change the first line to:

if (AFMergeChange(event).length==event.target.charLimit) {

The code will "disappear" after you enter it, but will still work.

However, when the dialog appears the last character entered will not be visible. I have yet to find a way around that...