Garry Claridge Posted February 17, 2002 Posted February 17, 2002 '-edit' edits only one record at a time. You will also need the '[FMP-CurrentRecID]' for each record so that you can edit them. I use Javascript for this sort of thing. I usually have a 'button' next to each record and when this button is clicked that record is updated in the database. Another way is by using a self-join in the database so that the found set is a 'portal'. A multiple edit effect can be achieved with a portal. Hope this leads you in a productive direction. Garry
lzeng Posted February 17, 2002 Posted February 17, 2002 Hi Garry: I greatly appreciate your prompt reply. I'm not familiar with JavaScript, could you show me an example? I know I need to combine "-Edit", [FMP-CurrentRecID] with JS. Now I have multiple "Submit" button in the page, the terrible thing is that when I update one record, I click on "Submit" button, then I access the format page. But I have to go back so that I can update the other records, what a mess! Thanks again for your help! Catty
Garry Claridge Posted February 17, 2002 Author Posted February 17, 2002 Catty, Firstly, the format file returned from the edit action sould be the same as the one the list is on. You can use tokens or [FMP-Link] to achieve this. Here is an example of some Javascript and cdml: code: <head> <script> function updaterec(myrecid) { document.edform.elements[1].value = myrecid ; document.edform.checkfield.value = "deleted" ; document.edform.submit() ; } </script> </head> <body> <form name="edform" ........> <input type="hidden" name="-db" ......> <input type="hidden" name="-recid" value=""> . <input type="hidden" name="checkfield"> <input type="hidden" name="-edit"> [FMP-Record] [FMP-Field:..... <a href="Javascript:updaterec('[FMP-CurrentRecID]');">remove item</a><br> [/FMP-Record] This code allows the CurrentRecID to be passed to a Javascript function which assigns it to the '-recid' form element and then submits the form. Hope this helps. Garry [ February 17, 2002, 03:04 PM: Message edited by: Garry Claridge ]
lzeng Posted February 18, 2002 Posted February 18, 2002 Hi, guys: I need to edit a list of records which are generated from a "-find". Now I have the following column on the result page: Record ID, FirstName, LastName, Finished, In "Finished" field, there should be a "checkbox" or "radiobutton" to allow users to check this record out, when checked, such record should be deleted from the list and shall not show up in this result page next time. I use [FMP-Record]...[/FMP-Record] so as to show the list of the records. Finally, I have <INPUT TYPE="submit" NAME="-Edit" VALUE="Submit"> in order to submit the form. However, it doesn't work. I checked "Finished" field on some records, but they don't show up in the database. Can anyone help me? Catty
lzeng Posted February 19, 2002 Posted February 19, 2002 Hi Garry: 1m away from success! If there is only one record shown on the format page - queueS2.htm, Javascript and CDML works well. But if there are several records shown up on the results page, the code can't update the specific record. Here is my code: code: ... Inside Body, I have: [FMP-LinkPrevious]-Previous-[/FMP-LinkPrevious] [FMP-LinkNext]-Next-[/FMP-LinkNext] ... [FMP-Record] <form action="FMPro" method="POST" name="edform"> <INPUT TYPE="hidden" NAME="-db" VALUE="Sample.fp5"> <INPUT TYPE="hidden" NAME="-recid" value=""> <INPUT TYPE="hidden" NAME="-format" VALUE="queueS2.htm"> <INPUT TYPE="hidden" NAME="-lay" VALUE="Layout #1"> <INPUT TYPE="hidden" NAME="-edit"> <INPUT TYPE="hidden" NAME="-error" VALUE="error.htm"> ... <INPUT TYPE="checkbox" name="Theatre_room_booked"> ... <INPUT TYPE="checkbox" name="Already_Operated"> ... <a href="JavaScript:updaterec('[FMP-CurrentRecID]');"> Update</a> ... </form> [/FMP-Record] Moreover, I tried to use code: <a href="[FMP-Link]&JavaScript:updaterec('[FMP-CurrentRecID]');"> Update</a> so as to get back to the same format page after updating, but it didn't work! Can you help me again? Thanks a lot! Catty
Garry Claridge Posted February 19, 2002 Author Posted February 19, 2002 Catty, Getting close. Try this: code: <form action="FMPro" method="POST" name="edform"> <INPUT TYPE="hidden" NAME="-db" VALUE="Sample.fp5"> <INPUT TYPE="hidden" NAME="-recid" value=""> <INPUT TYPE="hidden" NAME="-format" VALUE="queueS2.htm"> <INPUT TYPE="hidden" NAME="-lay" VALUE="Layout #1"> <INPUT TYPE="hidden" NAME="-edit"> <INPUT TYPE="hidden" NAME="-error" VALUE="error.htm"> ... <INPUT TYPE="checkbox" name="Theatre_room_booked"> ... <INPUT TYPE="checkbox" name="Already_Operated"> ... [FMP-Record] <a href="JavaScript:updaterec('[FMP-CurrentRecID]');"> Update</a> [/FMP-Record] ... </form> This keeps just one form. The Javascript only adds the 'currentrecid'. It can change and check other values though. Hope this helps. Garry
Garry Claridge Posted February 19, 2002 Author Posted February 19, 2002 This is now where I usually have a 'return' format file. (Other people may have better ways of doing it.) You could have: <input type="hidden" name="-format" value="queueS2ret.html"> in "queueS2.html". The 'queueS2ret.html' file would look like this: code: <head></head> <body onload="Javascript:document.listfm.submit();">....updating <form name="listfm" action="FMPro" method="POST"> <INPUT TYPE="hidden" NAME="-db" VALUE="Sample.fp5"> <INPUT TYPE="hidden" NAME="-format" VALUE="queueS2.htm"> <INPUT TYPE="hidden" NAME="-lay" VALUE="Layout #1"> <INPUT TYPE="hidden" NAME="myfield" VALUE="[FMP-CurrentToken]"> <INPUT TYPE="hidden" NAME="-find"> </form></body> The form submits automatically. The aim is to use tokens to reconstruct the original search. Hopefully the original search is not complex. Getting there. Garry
lzeng Posted February 19, 2002 Posted February 19, 2002 Hi Garry: Thanks for posting your example! I'm still not quite understand the "checkfield" in your example: function updaterec(myrecid) { ... document.edform.checkfield.value = "deleted" ; ... } Then you have <input type="hidden" name="checkfield"> ... In my result page, is the following correct? function updaterec(myrecid) { document.edform.elements[1].value = myrecid ; document.edform.Theatre room booked.value = "yes" ; document.edform.Already Operated.value = "yes" ; document.edform.submit() ; } Then inside body, I have: <form name="edform" ........> <input type="hidden" name="-db" ......> <input type="hidden" name="-recid" value="">. <INPUT TYPE="checkbox" name="Theatre room booked" value="yes"> .. <INPUT TYPE="checkbox" name="Already Operated" value="yes"> <input type="hidden" name="-edit"> I wonder how I shall deal with these checkboxes? I got "Error in page" after processing. What are the mistakes? Thanks very much! Catty
Garry Claridge Posted February 19, 2002 Author Posted February 19, 2002 Catty, The 'checkfield' was only a demonstration field. You don't need to reassign these two fields because you assigned values initially: document.edform.Theatre room booked.value = "yes" ; document.edform.Already Operated.value = "yes" ; However the prolem would be with the spaces in the field names. So if you did want to reassign values to these fields you would use; document.edform.elements[x].value etc The 'x' is the number of the <input> tag starting at '0'. All the best. Garry
lzeng Posted February 19, 2002 Posted February 19, 2002 Hi Garry: So happy to get there! I greatly appreciate your kind guidance and tremendous help! All the bests! Catty
Recommended Posts
This topic is 8410 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