×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Custom Dialog Boxes

Custom Dialog Boxes

Custom Dialog Boxes

(OP)
I have a layout which will serve as an input form for data,
With filemaker you have the option to have the database save data with every key pressed on the keyboard or you can have the option of FileMaker asking the user if they want to save the data.

In my case, i would like to have the user input data and then
have a submit button which i would have a script running when the button is pressed, i will have filemaker automatically save as the user enters data (which the user will have no idea since there will be a submit button).

The way i intend to have this script run is, there will be a custom dialog box asking the user if they would like to submit to save the record where they will either choose yes, no, or cancel (cancel so they can make further changes).  If they choose yes i would just have filemaker direct the user back to the view only mode with the record they have just made being the record that is shown.  If the user chooses no
i would delete the record and then redirect the user back to the view only or into the input layout with an empty form.

The problem i am having is that i do not know how to link the buttons from my custom dialog to the rest of the script, such that an if statement will be checking which button has been pressed (yes, no, cancel).

i am using filemaker 7

RE: Custom Dialog Boxes

So basically you want the user create a new record, fill in data and at the end a choice to 'save' the new record if the Yes button is pressed or delete the record if No ?

If the choice is Yes, you want the user end up in the just created record ?

RE: Custom Dialog Boxes

(OP)
In a nutshell

the user will enter data and then click on a submit button
then a custom dialog will appear asking if they wish to save
with three buttons, yes, no, cancel (cancel will allow them to
edit any information before they decide to save).

Then if the answer is Yes then the record would be "saved" (meaning the record will not be deleted) and would then take them back to the view only mode which now contains the new record.

IF No was clicked then filemaker will delete the record and take them back to the new record input form with all the data they input gone.

If the third button was clicked (maybe named, make changes to record, or cancel)
the user will be able to modify any data they may have entered before they decide to save.

To do this i need to link the buttons from the custom dialog to the script. This is where i am stuck i do not know how to get the custom dialog buttons to link to the if statements i would have in the script.

RE: Custom Dialog Boxes

Basically it's not such a good idea to already create a record and then yes/no delete this record again.
Suppose you have (or will have in the future) a linked number system or serial, with deleting the record you will have to make sure the serial (or whatever system) is also reset to the previous value, and I can come up with some other reason to not follow this way.

What I suggest is to make a layout where you put all the fields needed to make a new record, but as global.

Redirect the user to this record when making a new record.
The user can fill in all the needed fields, delete data, re-enter etc.

Put 2 buttons on this layout. 1 "Cancel", 1 "Register".
Link a script to the Cancel button, something along these lines:
Set Field(fieldName1_gt;"")
Set Filed(fieldName2_gt:"")
etc for all the global fields on that layout.

This script will clear all the global fields.
This way, still no record creation and as last step you can redirect the user to whatever place you want/need.

The Register button has a script along these lines:
Create Record
Set Field (yourFirstField;fieldName1_gt)
Set Field (yourSecondField;fieldName2_gt)
etc for all the global fields on that layout.
Set Field (fieldName1_gt;"")
Set Field (fieldName2_gt;"")
etc for all the global fields

This script will create a new record, set all the needed fields to the values in the corresponding global fields and will clear the globals, ready for the next new record.

To avoid wrong or missing data in the input, you could tweak the script.
Suppose there is a need to have some fields with data in it, those fields are not allowed to be empty.
You need a way to prevent the record creation.
A way to do that is presenting the user with the Register button, only after those fields have a value.

Suppose you have a field with a constant value = 1.
Make a calculationfield, result number along these lines:
Case(
notIsEmpty(yourField1) and notIsEmpty(yourField2) etc...for all the needed fields;1)

This will result in a value 1 if all the data are in the needed fields.
Make a relationship between the constantfield and your calc field.
Put a portal on your input layout, with the registerbutton in it, the portal 1 pixel larger than your button, ni lines.
This will make the portal invisible.

Only when all the fields has data, the relationship will match, so the Registerbutton will show in the portal. No match, no button = no way to create a record....

This in a nutshell, but I think you get the idea....

HTH

RE: Custom Dialog Boxes

(OP)
Ok so what youre saying is if have a database that has X number of fields that compose a record, i make 2x fields first half is the fields that actually hold data the other half are global fields that will correspond to the first half.

In my input layout i have buttons that will Register the record or cancel and make the input empty.  If the user presses cancel i can just set all the global fields to "".

If register is pressed i have a script that will create a new record set the non global field = to the global field that was entered and then empty the global fields and direct them back to a new record input for again and the process can start over or they can navigate to other parts of the database

RE: Custom Dialog Boxes

(OP)
Ok ive tried the algorithm

However the fields in the other layout where they are set to the value of the globals are not taking in the values input into the global field when i press the submit button.

What i have for the script is

New Record/request
SetField[arbitraryTable::Field 1 = Field 1 GLOBAL]
SetField[arbitraryTable::Field 2 = Field 2 GLOBAL]

SetField[arbitraryTable::Field 1 GLOBAL = ""]
SetField[arbitraryTable::Field 2 GLOBAL = ""]

etc.

RE: Custom Dialog Boxes

(OP)
Ok i found the mistake

Thanks for the help

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close