Gossamer Forum
Home : Products : DBMan : Customization :

Modify This Record

Quote Reply
Modify This Record
Here is what I need:

I need a link on a record that is "Modify This Record" when clicked brings user to modify form - in other words, user is logged in and does a search or list all - selects a record - then instead of going back to modify and searching for same record simply clicks on a link that goes directly to modifying this record -

Thanks, jim
Quote Reply
Re: [jimogrady] Modify This Record In reply to
I did add the following to html.pl - but got an error message:

print qq!| <A HREF="$db_script_link_url&modify_form=1">Modify This Record</A> ! if ($per_mod);


The error was: <> Error no search terms specified

Your help is appreciated.

added to: sub html_footer
Quote Reply
Re: [jimogrady] Modify This Record In reply to
You only want this link to show up when you've done a search and there is only one record returned from the search. Otherwise you'd want the regular Modify link to appear.

Here's what I would suggest. In sub html_footer, replace the "modify" line with the following:

Code:

if ($per_mod) {
if ($db_total_hits == 1) {
print qq! | <A HREF="$db_script_link_url&$db_key=$rec{$db_key}&modify_form_record=1">Modify This Record</A> !;
}
else {
print qq!| <A HREF="$db_script_link_url&modify_search=1">Modify</A> !;
}
}


I haven't tested this and there is a potential problem. If you still get a "no search terms specified" error message, you'll need to change something in sub html_record. Change

my (%rec) = @_;

to

%rec = @_;


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] Modify This Record In reply to
Thanks for the reply - i added both of what you suggested - but, when it goes to the modify form there is nothing in it - how do I get the contents of that record in it?

Thanks again,

Jim
Quote Reply
Re: [jimogrady] Modify This Record In reply to
My mistake. I didn't look closely enough at the subroutines.

Change

print qq! | <A HREF="$db_script_link_url&$db_key=$rec{$db_key}&modify_form_record=1">Modify this Record</A>|;

to

print qq! | <A HREF="$db_script_link_url&modify=$rec{$db_key}&modify_form_record=1">Modify this Record</A>|;

That's what I get for working from another computer and trying to do it from memory. :-)


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] Modify This Record In reply to
Thanks - that worked perfectly, I appreciatet your help.

Jim
Quote Reply
Re: [jimogrady] Modify This Record In reply to
Well - I needed to ad the long/short mod - which works fine - but now when clicking the Modify This Record - it does not pull the data into the form - see it at: http://www.mymoneymailer.com/cgi-bin/dbman/db.cgi

Thanks, no other changes made to this basic dbman setup -

Jim
Quote Reply
Re: [JPDeni] Modify This Record In reply to
did not know if you got this reply:

Well - I needed to ad the long/short mod - which works fine - but now when clicking the Modify This Record - it does not pull the data into the form - see it at: http://www.mymoneymailer.com/cgi-bin/dbman/db.cgi

Thanks, no other changes made to this basic dbman setup -

Jim
Quote Reply
Re: [jimogrady] Modify This Record In reply to
I see a couple of problems. First, the fact that the modify form isn't filled in is due to the bolding of the search term.

At the beginning of sub html_footer, add

$rec{'$db_key'} =~ s/<?.B>//g;

That should fix that problem.

The other problem is that the "Modify This Record" link shows all the time. I guess it's okay, but it doesn't suit my aesthetic taste to have the link appear when there isn't a "this record" to be modified.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] Modify This Record In reply to
that did not work - no errors, but still no data in fields -

thanks,

Jim
Quote Reply
Re: [jimogrady] Modify This Record In reply to
The reason you're not getting the fields filled in is that the key value for the record is bolded. If you take a look at the URL when you click the "Modify this Record" link, you'll see something like:

&modify=<B>2</B><B></B>

If you remove the bolding tags from the URL and hit return, you'll see the form with the fields populated.

You can easily fix this by turning off the bolding of search terms in your .cfg file, but you may want to have search terms bolded. The code I gave you in my previous post should take the bolding tags out of the $rec{$db_key} value before it is added to the "Modify this Record" link. It's always worked before. The only thing I can think of is that you put the code for the link before the code to remove the bolding.

If this doesn't make much sense to you, the best thing to do is to post your sub html_footer subroutine here and I'll see what I can figure out.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [jimogrady] Modify This Record In reply to
I just thought of something else. Since you're using the short/long display mod, the only time it would be logical to use the Modify this Record link would be in the long display. Instead of having the link in the footer, put it in sub html_record_long, below the output of the record. This is the code you would use:

Code:
$rec{'$db_key'} =~ s/<?.B>//g;
print qq! <A HREF="$db_script_link_url&modify=$rec{$db_key}&modify_form_record=1">Modify this Record</A> ! if ($per_mod);


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] Modify This Record In reply to
Thank you for all your time on this - everything is no functioning - I appreciate very much your effort.

Jim
Quote Reply
Re: [jimogrady] Modify This Record In reply to
Glad I could help. :-)


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.