FM_n00b Posted June 30, 2009 Posted June 30, 2009 I have published my db via IWP with a script running at startup to hide and lock the status area, so that my layout is all that shows. I have created buttons to navigate records, layouts, create a new record and delete the current record. In FMP10, clicking the delete record button in layout mode will bring up a prompt asking "Permanently delete this ENTIRE record?" this is GOOD i want this. In IWP however, clicking the same button simply instantly deletes the record. I checked to make sure that the "Perform without dialog" checkbox is UNCHECKED Clicking the delete record button in the status area of IWP shows the prompt so i know that it's possible in IWP, but i want to replicate this button in my layout so that the status area does not need to be shown What am I doing wrong?
bcooney Posted June 30, 2009 Posted June 30, 2009 Show dialog is not a web-compatible script step. In scripts, at the bottom left, select Web Publishing from the Show Compatibility popup. All incompatible script steps are grayed out.
IdealData Posted June 30, 2009 Posted June 30, 2009 Armed with what you know now - DIALOGS ARE NOT WEB COMPATIBLE - you may need to develop a new strategy to handle the dialogs for IWP. Oee way would be to have a specific layout to display your message with several buttons to 'Cancel', 'Accept' etc. and process through a script.
FM_n00b Posted June 30, 2009 Author Posted June 30, 2009 thanks for your help guys, i'll look into creating a dedicated layout for that step. what I don't get is why the dialog works from the status area but not from a script step... seems like they already did the work to make dialogs work in web browsers but then stopped short of having them function from layout buttons
FM_n00b Posted June 30, 2009 Author Posted June 30, 2009 (edited) ok so here is how i have set this up so far: clicking Delete when viewing a record will run a script that does the following Go to Layout["Delete Confirmation"] Pause Script Delete Record[No dialog] Go to Layout[original layout] so that the user is sent to the confirmation layout and the script is halted until they click the Delete button, which resumes the script. My new problems are 1. I would preferably like to use this layout to confirm record deletion from any table, whereas right now it only works with the table that the delete confirmation layout is set to show records from 2. I cannot get the Cancel button to work, right now I have it set to Exit script and then Go to Layout[original layout] but this only exits the script, I would like the user to be sent back to the layout they came from is any of that possible? Edited June 30, 2009 by Guest
bcooney Posted July 3, 2009 Posted July 3, 2009 You'll need to pass the layoutname, and recid to the Delete script using scriptparameters. You can do this by entering each parameter with a space btw them, such as: Get (LayoutName) table:keyID. Then the Delete script would: 1. Go to the delete confirmation and pause. Base this layout on any table occurrence, but I'd use a Sys table. 2. User clicks Delete. 3. Go to layout by calculation= Left words (Get (Scriptparameter), 1) 4. Enter Find Mode 5. Go to object "key". Name each key field in each table "key" so that you can avoid hard-coding the next Set Field step. 6. SetField (Leftwords (Get(scriptparameter), 2) ) (important, if you don't specify a field, set field will just set whatever field you're in. This is very useful to you, as you don't know what table you're in. 7. Perform find. 8. Delete record. 9. I don't know where you want to go from here. Perhaps you're already there. Now the Cancel button on the Delete confirmation has a button behavior of Exit Current Script (this gets you out of the pause). It runs a script that just Go to Layout (original layout). Those are my ideas.
FM_n00b Posted July 7, 2009 Author Posted July 7, 2009 thank you, this works great except: -it only works if the layout has a one-word name, -table:keyID doesnt work, so i had to replace it with the actual table name (eg Contracts::keyID) manually in each layout. is there a way of calling the table name like Get(TableName)? -the cancel button still successfully exits the script but does not return to the original layout, i think this is because the cancel button is initiated in the Delete layout, so the "original layout" that i am returned to is the same one.
David Jondreau Posted July 7, 2009 Posted July 7, 2009 I can help you with one of those issues. Instead of using a space as a delimiter in the parameter, use a ¶, and use the GetValue() function on your script parameter.
FM_n00b Posted July 8, 2009 Author Posted July 8, 2009 thank you for your help. i have already fixed the one-word problem by using: LeftWords(Get(ScriptParameter);WordCount ( Get (ScriptParameter) )-1) so that it takes every word except the last word from the script parameter. although i still don't know how to get the table names using a function, i will have to just remember not to change table names for now. my only problem that remains is the cancel button. is there a way of making a global variable that will store the last layout visited, so that the cancel button can just go to layout name by calculation and then it could just =global field ??
Recommended Posts
This topic is 5885 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 accountSign in
Already have an account? Sign in here.
Sign In Now