Jump to content

cancel add record w/required fields


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

Recommended Posts

  • Newbies

I have a db with three required fields. I want to use a script to allow a user to cancel a record add. As is, I keep getting the error that fields are empty... how can I cancel the add. (Related, maybe...how to postpone save of a record?).

Link to comment
Share on other sites

The approach I've taken with this sort of situation is to script the entire process like so:

User clicks on New Record button, which calls New Record Script

New Record Script takes user to a layout with global fields (one global field per actual data field). This layout also has two buttons: Cancel and Submit.

If user clicks on Submit, the script creates a new record and populates the fields with the values in the matching global fields. You can also test for required values at this point, either within the script itself or using FileMaker's built-in validation. Doing validation through ScriptMaker allows for a more complex validation procedure.

If the user clicks on Cancel, the script simply returns the user to the original layout.

In both cases, the script will clear the global fields regardless of which button was clicked.

Hope this helps!

Link to comment
Share on other sites

I script such processes start to finish too, but without adding global fields.

The mandatory fields are not set up to be Not Empty in the field validation setup, because the controlled New Record script is already taking care of that.

When they add a new record, the New Record layout only allows them the Cancel or Enter option. Cancel backs out of the New Record script, and deletes the new record that was aborted.

The Enter script checks to make sure all fields were entered as needed, and only then proceeds.

This way no Global fields are needed.

Link to comment
Share on other sites

  • Newbies

Originally posted by Sharka:

>>Cancel backs out of the New Record script, and deletes the new record that was aborted.

Q: what is "backs out" in terms of script?

>>The Enter script checks to make sure all fields were entered as needed, and only then proceeds.

Q: example?

I'm pretty new to scripting and would greatly appreciate any examples.

-TIA

Andrew

Link to comment
Share on other sites

Sorry for my cryptic responses... I hope this helps.

By 'Backs out' I meant that if you select the CANCEL script, it returns you to where you started, _and_ deletes the new record you started, but never finished (because you chose the Cancel option).

- -

>>The Enter script checks to make sure all fields were entered as needed, and only then proceeds.

The Enter script allows you to proceed, but only after it's checked to see that the mandatory fields have been filled in. For example, a simple ENTER script, checking to see that two fields are not empty could look like this.

IF ["IsEmpty(field_1)"]

Exit Script

END IF

IF ["IsEmpty(field_2)"]

Exit Script

END IF

--- proceed with script ---

You can make the IF conditionals more complicated than just seeing if the field is empty, as the ones above do. Checking for characters entered, etc.

In the case above, if for exmaple field_1 is empty, it exits the script. you could add a Show Message just prior to the Exit Script step, telling the user user whicih field they need to fill in before proceeding.

HTH smile.gif" border="0

Link to comment
Share on other sites

This topic is 7233 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
 Share

  • Who Viewed the Topic

    1 member has viewed this topic:
    anteas 
×
×
  • Create New...

Important Information

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