ibiubu Posted September 11, 2002 Posted September 11, 2002 Been working on trying to get a grasp on Tokens. On my main web page a find is performed. The resulting page contains a simple form, example below: <form action="FMPro" method="post" name="Edit"> <input type="hidden" name="-RecID" value="[FMP-field:Record ID]"> <input type="hidden" name="-error" value="errors3.htm"> <input type="hidden" name="-lay" value="Budgets"> <input type="hidden" name="-DB" value="Budget.fp5"> <input class="text" type="text" name="Statement" value="[FMP-field:Statement]"> <input type="hidden" name="-format" value="budget3.htm"> <input type="submit" name="-Edit" value="Submit Here is the question on the token. This form works as it should. When submitted the resulting -format page is loaded. I have this page set up so that the user can continue with further edits. But this does not work. It is like the user is out of the database at this point. Does this mean I might have to include a token in the form above so that when the -format resulting page is loaded I dont loose my current database string? Larry
Garry Claridge Posted September 11, 2002 Posted September 11, 2002 Larry, The first -edit should still work like a -find, in that, it should return the correct [FMP-CurrentRecID] for use in the second -edit page. If not this is where you may need ot use a -Token to pass the -RecID along. What happens when you try to submit the second edit page? Garry
ibiubu Posted September 11, 2002 Author Posted September 11, 2002 here is what happens. When I edit my budgets2.html page the address in the browser window is something like this: http://63.xxx.xxx.xxx/FMPro?-db=budgets.fp5&-layout=Budget&-Format=budget2.htm&-RecID=108&-find I hit submit. The budgets2.html page is reloaded through -format. Now the address in the browser has changed to this: http://63.xxx.xxx.xxx/FMPro If I now try to make changes to that page and hit submit it goes to my error page without submitting the changes. LR
CyberSport Posted September 11, 2002 Posted September 11, 2002 Well, it seems that the problem could be with your RecID tag. Unless you really have a field in your DB which is called "Record ID," what you really want is the following: <INPUT TYPE="hidden" NAME="-recid" VALUE="[fmp-currentrecid]"> Are you getting an error code on your error page? A good way to check/debug is, when testing, to actual put the code "[fmp-currentrecid]" somewhere in the body of your pages. That way, you can track whether or not FMP is passing the RecID. Also, check out the source of your second page after it loads. Check to see that in the above code (the 3rd line), the replacement tag is correctly inserting the currentrecID. Good Luck. Bevin
ibiubu Posted September 11, 2002 Author Posted September 11, 2002 And BINGO was his name o. That one did it. fmp-currentrecid. I should have caught that one. LR
ibiubu Posted September 14, 2002 Author Posted September 14, 2002 OK, here is a variation on the above problem, but slightly different. Instead of a form, this is a URL link for delete. Kind of ran into a problem with it: FMPro?-db=budgets.fp5&-lay=Budget Web&-format=budget.htm&-recid=[FMP-currentrecid]&-Delete This is a link that sits in a table for a portal [FMP-Portal:Budgets] Multiple lines of items may exist in the portable. Using the URL link above will only delete the first portal item. If I select the delete link on any other line I get the error that the record could not be found. I think it is finding the current record id of the master record, not the id of the related record in the line of the portal. Do I need to include a variation something like [FMP-Budgets::currentrecid] to make it look at the portal rows record ID instead of the parent records ID? The below one works but not completely as I want, I would prefer to get the one above to work: FMPro?-db=budgets.fp5&-lay=Budget Web&-format=budget.htm&-recid=[FMP-field:Budgets::RecordID]&-Delete This will delete the record on any row, then I am returned to the -format page, but at that point any further edits I try to perform wont work. Loses my correct connection with the record. I have to hit the back button a few times, hit the refresh button, then I can continue. Trying to get it so that on the Budget.htm page, I can hit the delete link on any portal row, delete that record, -format returns to the budget.htm page without losing the current record status, and continue editing the page if possible. LR
Garry Claridge Posted September 14, 2002 Posted September 14, 2002 Larry, Here is one I wrote nearly two years ago, hence I'm not sure if it is still the best way to do this. It uses a Calculated field ('rec_id') in the related file. The field contents are 'Status(CurrentRecordID)'. It uses some Javascript and submits a form for portal row deletion. The Javascript within the HEAD tags: <script> function rmvrow(rmvrecid) { if (confirm("Remove Item?")) { document.rmvrowfm.elements[7].value = rmvrecid ; document.rmvrowfm.submit() ; } ; } </script> Now the FORM within the BODY:<form name="rmvrowfm" action='http://[FMP-CurrentToken:0][FMP-CurrentToken:1]/FMPro' method='post' target='quote'> <input type="hidden" name="-db" value="quote_line_items.fp5"> <input type="hidden" name="-lay" value="web"> <input type="hidden" name="-format" value="/digi_lan/editreturn.html"> <input type="hidden" name="-token.0" value="[FMP-CurrentToken:0]"> <input type="hidden" name="-token.1" value="[FMP-CurrentToken:1]"> <input type="hidden" name="-token.2" value="[FMP-CurrentToken:2]"> <input type="hidden" name="-token.3" value="[FMP-Field:quote_id]"> <input type="hidden" name="-recid" value=""> <input type="hidden" name="-delete"></form> Now the CDML within the BODY:[FMP-Portal:quote_Id_rel] <a href="Javascript:showitem('[FMP-Field:quote_Id_rel::item_id]');">[FMP-Field:quote_Id_rel::item_id]</a> [FMP-Field:quote_Id_rel::item_name] <input type="text" name="quote_Id_rel::quanity.[FMP-CurrentPortalRowNumber]" value="[FMP-Field:quote_Id_rel::quanity]" size="4"> [FMP-Field:quote_Id_rel::sell_price_ex_tot_txt] [FMP-Field:quote_Id_rel::supplier_price_old] <a href="Javascript:rmvrow('[FMP-Field:quote_Id_rel::rec_id]');">remove</a> [/FMP-Portal] I removed the formatting for clarity. Here is the 'editreturn.html' page: <html> <head> <title>Edit Return</title> <meta name="generator" content="BBEdit 6.5.2"> </head> <body onload="Javascript:document.edreturnfm.submit();">...updating quote <form name="edreturnfm" action='http://[FMP-CurrentToken:0]:[FMP-CurrentToken:1]/FMPro' method='post' target='quote'> <input type="hidden" name="-db" value="quotes.fp5"> <input type="hidden" name="-lay" value="web"> <input type="hidden" name="-format" value="/digi_lan/editquote.html"> <input type="hidden" name="-token.0" value="[FMP-CurrentToken:0]"> <input type="hidden" name="-token.1" value="[FMP-CurrentToken:1]"> <input type="hidden" name="-token.2" value="[FMP-CurrentToken:2]"> <input type="hidden" name="quote_id" value="[FMP-CurrentToken:3]"> <input type="hidden" name="-find"> </body> </html> I'm not sure if returning to the main edit page like this is the best way however, it works. This whole application works very well, so I guess it is still OK. All the best. Garry
Recommended Posts
This topic is 8097 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