Jump to content
Server Maintenance This Week. ×

Validating custom dialog input field


This topic is 3581 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hello everybody,

 

I have a database where the very first step is to add a new patient.

When the button is hit, a custom dialog box pops up asking for patient last name, first name and social security number (ssn).

The SSN is validated so to be unique and to show a warning message in case inserted patient has the same SSN as a previous one (i.e. the same patient has been created twice).

When everything goes well (that is, SSN is unique), the record is created in the current demographics table and also new records are created in related table as appropriate. The whole procedure is script driven.

When the same patient is inserted twice (i.e. the user is trying to insert a patient with the same SSN that has been already used), the warning message pops up appropriately, and when the used decide to "revert field" current record in the Demographics table is actually not created, but the script does not stop and creates empty records in the related tables.

Beyond the fact that the options in the warning message when the validation fails are not totally clear to me (Ok for "Revert field" but what about "Yes" or "No" ?), I have created an If statement so that

If not IsEmpty(fieldSSN)

then go ahead with the script

Else

Exit script.

Now, even when the user correctly decide to Revert field, the script goes on no matter what, and I cannot understand why...

 

Any help, as usual, will be greatl appreciated !

 

Diego

 

Link to comment
Share on other sites

The usual first step when asking a question about a script is to show the script.

 

Please create and attach a PDF copy of your script, or provide a copy or clone of your file.

Or; a screen shot.

Link to comment
Share on other sites

Beyond the fact that the options in the warning message when the validation fails are not totally clear to me (Ok for "Revert field" but what about "Yes" or "No" ?) ...

Now, even when the user correctly decide to Revert field, the script goes on no matter what, and I cannot understand why...

 

Hi Diego,

 

Although Bruce is correct that seeing the script would help, it certainly must be because you are not checking to see whether the User selected Yes or No.  You do this by using an If[] and checking for Get ( LastMessageChoice).  So an example might be:

 

Show Custom Dialgog [ bla bla ; "Yes" ; "No" ]

If [ Get ( LastMessageChoice ) = 1 // user selected yes ]

... do this

Else

// user selected NO

... do this other thing

End If

Link to comment
Share on other sites

So we're talking about two dialog boxes: 1) the initial custom dialog, and 2) the field validation fail dialog.

 

For the first one, you may want to experiment with using global fields for the dialog and scripting a Find for duplicates, rather than creating a new record and then reverting it. This may obviate the issue with dialog 2.

 

You have FM Advanced -- turn on script debugger and show the data viewer. You'll see exactly what's going on.

Link to comment
Share on other sites

This topic is 3581 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.