Gossamer Forum
Home : Products : DBMan : Customization :

javascript jump back

Quote Reply
javascript jump back
I have made DBMan create href links beside each record when it is displayed in sub html_record. This means that a user can simply click on a link and directly edit / delete a record. The problem is when a record is being viewed as part of a search. Once the user has modified the record, they are at a dead end so to speak. The must manually click the back button on their browser 2 times and then hit refresh to show the newly updated information as search results.

As a partial solution, I have found the java script to make the browser go back 2 steps, but the page is displayed from cache. How do I make it refresh once it is displayed again?

<FORM>
<INPUT TYPE="Button" VALUE="Return to Record" onClick="history.go(-2)">
</FORM>

For what it's worth, one of the first lines in my sub html_record is print qq|<a href="$db_script_url?db=default&uid=$db_uid&ID=$rec{'ID'}&modify_form=1">EDIT THIS RECORD</a>| if ($per_mod);

This lets users have easy access to editing a record if they are viewing it. Thanks to JP Deni's relational mod for the clue on this one!

Wes
Quote Reply
Re: [kd4rdb] javascript jump back In reply to
How about using modify_success ? You could pass along a tag like this:

1. print qq|<a href="$db_script_url?db=default&uid=$db_uid&ID=$rec{'ID'}&modify_form=1&quickEdit=1">EDIT THIS RECORD</a>| if ($per_mod);

2. then when they modify the record you have a hidden tag <INPUT TYPE="hidden" NAME="$in{'quickEdit'}" VALUE=""> (but you don't have to add it to your db)

3. then under modify_success you do something like:

if ($in{'quickEdit'} eq "1") {print qq|<META HTTP-EQUIV = REFRESH CONTENT = "0; URL=$db_script_url?db=default&uid=$db_uid&ID=$in{'ID'}&view_records=1"|;}

(or whatever the view record tag is view_form, view_record, view_records, whatever.)

Notice how sometimes we are using $in{'field'} (as opposed to $rec{'field'})

Give it a whirl and see what happens. I'm guessing at a lot of this, but the concept is right.
Quote Reply
Re: [Watts] javascript jump back In reply to
Well this is what I'm doing now. (great minds think alike) The problem is that where you land when the URL redirect executes. This does indeed display the updated record. If I'm doing a search, and am looking at 100 records in a row (the results of the search), and get to record #50 and need to edit it- then I must "step off" to the side edit the record, and then I need to reenter my search results back at record #50 or #51. This posting has me thinking (the point to this whole exercise ;) ) I'm gunna have to look at passing 'next hits' and the like forward. dunno... If I do this your suggested way (the way I'm actually doing it now), after the edit, I end up at a dead end. If I wanted to see record #51 in my search, I have to begin the search again, or simply go back with the browser button two steps until I can see the next hits search results page again. From that point I can go forward. Thank you though for the suggestion! Wes


In Reply To:
if ($in{'quickEdit'} eq "1") {print qq|<META HTTP-EQUIV = REFRESH CONTENT = "0; URL=$db_script_url?db=default&uid=$db_uid&ID=$in{'ID'}&view_records=1"|;}
(or whatever the view record tag is view_form, view_record, view_records, whatever.)

Notice how sometimes we are using $in{'field'} (as opposed to $rec{'field'})

Give it a whirl and see what happens. I'm guessing at a lot of this, but the concept is right.
Quote Reply
Re: [kd4rdb] javascript jump back In reply to
What I use for a quick link to modify records is:

|;
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|

It is a different version than what you are using. Also to make it easy you could just right click on the link and tell it to open in a new window :)

To return to a previous search check out the FAQ noted below under "Seaching - Navigate" where you can find a few ideas to try out.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/