Gossamer Forum
Home : Products : DBMan : Customization :

Pass current record ID to Modify request

Quote Reply
Pass current record ID to Modify request
Is there a way to pass the Current Record ID into the URL code for the Modify menu option? This would save users remembering the ID or having to List All to select a record to modify. I cannot find any references in a Forum Search.


David Olley
Anglo & Foreign International Limited,
http://www.afil.co.uk
Quote Reply
Re: Pass current record ID to Modify request In reply to
I *think* this is what you are looking for, but I could be wrong:

<A HREF="$db_script_link_url&modify_form=1&$db_key=$rec{'Key'}"> Modify </A>


Quote Reply
Re: Pass current record ID to Modify request In reply to
I tried your code (I replaced 'Key' with 'ID', being the name of the $db_key), but "error: no matching records" was returned.
I thought this was the way to go, and had tried similar syntax without success.
Does the db.cgi file need modification, perhaps?
Thanks for your help.

David Olley
Anglo & Foreign International Limited,
http://www.afil.co.uk
Quote Reply
Re: Pass current record ID to Modify request In reply to
Try JP Deni's Automatic View/Modify Search at:http://www.jpdeni.com/dbman/Mods/autosearch.txt

I use it on my site and it takes the logged in user directly to their own record when they modify or delete without the need to search.


Quote Reply
Re: Pass current record ID to Modify request In reply to
I already use that code in my .pl file.
In this case the user has numerous records owned by him. I have, of course, set up permissions so that a user can only modify his own records, so when he selects modify, he will only be presented with a list of his records.
What I want him to be able to do is go to modify from the record display (Long Display) without having to go through the laborious selection routine.
I am certain that Eliott or another Veteran will know whether or how it can be done.
Thanks anyway.

David Olley
Anglo & Foreign International Limited,
http://www.afil.co.uk
Quote Reply
Re: Pass current record ID to Modify request In reply to
try this:
Code:
<A HREF="$db_script_link_url&modify_form=1&ID=$rec{'ID'}"> Modify</A>
Of course, you should only have this button available on the display of a record and not the main footer.

Trev

Quote Reply
Re: Pass current record ID to Modify request In reply to
I tried that, too, TrevR, but no joy. Same response as other methods.

Perhaps it is not possible to do this, as even the acknowledged experts have not responded (or maybe they are on vacation).
Thanks anyway.

David Olley
Anglo & Foreign International Limited,
http://www.afil.co.uk
Quote Reply
Re: Pass current record ID to Modify request In reply to
OK. I have found a solution which works very well.

I have added the following code to html.pl in sub html_record_long (within the page, below the fields):

<form action="$db_script_url" method="POST">
<INPUT TYPE=RADIO NAME="modify" VALUE="$rec{$db_key}">
<input type=hidden name="uid" value="$db_uid">
<input type="SUBMIT" name="modify_form_record" value="Modify">
</form>

This places a radio button which must be checked before hitting the Modify button. Then you are taken straight to the modify form which displays the record. It saves going through the list all and select process.

In addition - and most important - you must switch off emboldening of search results in the cfg file, or the record ID is returned surrounded by html bold tags which destroys the search parameters.

It works.

David Olley
Anglo & Foreign International Limited,
http://www.afil.co.uk
Quote Reply
Re: Pass current record ID to Modify request In reply to
How I do this is to use in sub html_record

|; }
print qq! <A HREF="$db_script_url?db=$db_setup&uid=$db_uid&modify_form_record=1&modify=$rec{$db_key}">Modify</A> ! if ($per_admin);
print qq|

This creates a quick link to the modify form. You can use this for the short display or within the long display. Just change the (if ($per_admin) to allow the permissions you want to use. You can have it be for admin only or if the person has modification rights.

Hope this helps



Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: Pass current record ID to Modify request In reply to
David,

I once wrote a mod that automatically prints out a "modify" button next to each search result provided the user has modifying permissions. I also added a "delete" button, if the user is allowed to delete.

The mod can be found here: http://gossamer-threads.com/...tach/250-kellmod.txt

I hope you find it useful.

kellner
Quote Reply
Re: Pass current record ID to Modify request In reply to
A much more elegant solution, LoisC. Many thanks. I think this is such a useful little Mod, as it saves a couple of unnecessary steps.

David Olley
Anglo & Foreign International Limited,
http://www.afil.co.uk
Quote Reply
Re: Pass current record ID to Modify request In reply to
Thanks Kellner. I will look through that Mod (now I have it).


David Olley
Anglo & Foreign International Limited,
http://www.afil.co.uk
Quote Reply
Re: Pass current record ID to Modify request In reply to
Yes, I wish i could remember who came up with that simple solution. I use it in many databases to make it easy for the admin to modify records.

I'm sure credit is provided and referenced in the FAQ noted below, perhaps under the "linking" or "syntax" sections.


Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/