Forums

This topic is locked

Detail page address

Posted 27 Jun 2003 21:47:02
1
has voted
27 Jun 2003 21:47:02 Dave Clarke posted:
Hi

this has probably been asked before but I cant find it so here goes

I have a link to a detail page using the standard goto detail page behaviour.

This is linking from a users name to a users messages, all well and good, however due to me being a bit thick when i created my database, instead of having them joined on the user id so that when they add a message there is a field in the messages table with the members id number from the members table, there is only the username in common, so the problem is when it goes to the detail page the username is displayed on the end of the url of the detail page and I don't want this , can I hide it somehow?
Hope this makes sense.

Thanks

Dave

ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome

Edited by - Davecl on 27 Jun 2003 21:47:28

Replies

Replied 28 Jun 2003 12:59:44
28 Jun 2003 12:59:44 Owen Eastwick replied:
You could get around it with a bit of JavaScript which submits a form instead of using a link with a URL paramater.

Set up your link and a hidden field within a form:

<form name="form1" method="post" action="Details.asp">
&lt;a href="#" onClick="Update(&lt;%= rsName.Fields.Item("Username".value %&gt<img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>; document.form1.submit();"&gt;DETAILS&lt;/a&gt;
&lt;input type="hidden" name="hidUser"&gt;
&lt;/form&gt;

**** Replace that smilie with a clise bracket: )


Then create a JavaScript function that updates the hidden field with the correct username.

&lt;script language="JavaScript"&gt;
&lt;!--
function Update(Username){
var User = Username
document.form1.hidUser.value = User
}
//--&gt;
&lt;/script&gt;


On your details page collect the username:

varUser = Request("hidUser"

Regards

Owen.

-------------------------------------------------------------------------------------------
Used programming books and web development software for sale (UK only): www.tdsf.co.uk/tdsfdemo/Shop.htm

Developer services and tutorials: www.drdev.net

Multiple Parameter UD4 / Access 2000 Search Tutorial: www.tdsf.co.uk/tdsfdemo/

Edited by - oeastwick on 28 Jun 2003 13:03:09
Replied 28 Jun 2003 20:04:15
28 Jun 2003 20:04:15 Dave Clarke replied:
Thanks Owen

I'll have a look.

ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Replied 28 Jun 2003 21:43:49
28 Jun 2003 21:43:49 Dave Clarke replied:
Hi Owen

Well I did it using the form as you suggested but rather than having the code you gave me in its entirity, I set the hidden field value to the username value of the users table then on the detail page simply filtered the messages table by Request("hiduser" .
Seems to work

<b>&lt;form name="form1" method="post" action="details.asp"&gt;
&lt;b&gt;&lt;font size="3"&gt;Most frequent visitor - &lt;a href="#" onClick="document.form1.submit();"&gt;&lt;%= UCase((rsetvisitor.Fields.Item("fldFirstname".Value)) %&gt;&lt;/a&gt; &lt;a href="#" onClick="document.form1.submit();"&gt;&lt;%= UCase((rsetvisitor.Fields.Item("fldLastname".Value)) %&gt;&lt;/a&gt;&lt;/font&gt;&lt;/b&gt; &lt;br&gt;
&lt;input type="hidden" name="hiduser" value="&lt;%=(rsetvisitor.Fields.Item("fldusername".Value)%&gt;"&gt;
&lt;/form&gt;</b>

Thanks again
&lt;img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle&gt;

ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome

Edited by - Davecl on 15 Mar 2007 18:25:55
Replied 08 Mar 2007 19:16:53
08 Mar 2007 19:16:53 Cognac Cognac replied:
I need help
&lt;% do while rs.eof%&gt;
&lt;form name="data" method="post" action="mypagelink.asp?action=2"&gt;
&lt;a href="mypagelink.asp?action=2" onclick="document.data.submit(); "&gt;&lt;/a&gt;
&lt;input type="hidden" name="something" value="&lt;%=rs("fieldvalue"%&gt;" /&gt;
&lt;/form&gt;
&lt;% rs.movenext
loop%&gt;

this is the skeleton of my code.. io am not using th exact field values and names...
Is This a wrong code?
I am not able to request the hidden value of object "something"
i even tried the following

&lt;form name="data" method="post" action="mypagelink.asp?action=2"&gt;
&lt;% do while rs.eof%&gt;

&lt;a href="mypagelink.asp?action=2" onclick="document.data.submit(); "&gt;&lt;/a&gt;
&lt;input type="hidden" name="something" value="&lt;%=rs("fieldvalue"%&gt;" /&gt;
&lt;% rs.movenext
loop%&gt;

&lt;/form&gt;

Still wouldnt work... Please help in debugging..
Replied 08 Mar 2007 19:18:30
08 Mar 2007 19:18:30 Cognac Cognac replied:
also want to tell you that i am not able to get the hidden field value after clicking the link between the anchor tags..
i forgot to post the text that has link .. in my previous post..
Replied 09 Mar 2007 14:47:47
09 Mar 2007 14:47:47 Cognac Cognac replied:
Ok now .. in my previous post .. do while is wrong ..

do while not rs.eof
loop

was what i wanted to write .. but made a mistake in hurry..
any help will be appreciated..
thanks

Reply to this topic