only first word of record displayed (1 Viewer)

emartel

Registered User.
Local time
Today, 10:12
Joined
Jan 15, 2005
Messages
48
Hi there,
on a website Im designing, i have a searchable shop which is populated from an access db. You click on a thumbnail image in the shop and it gives you more details about the item on another page; this is done using the form method post action, and the extra details are stored in a hidden tex box on the main shop page and posted to the second page on click.
Only, on the page it posts to, it only displays the first word of the extra details (ie: everything up until the first space).
A way round it is to enter   (ie: " this is my data ") in place of every space in the cell, but obviously this is not ideal. I've tried sticking the data between <p> tags too, and that didn't work.

I would really appreciate it if anyone could help me with this!
 

dan-cat

Registered User.
Local time
Today, 18:12
Joined
Jun 2, 2002
Messages
3,433
emartel said:
posted to the second page on click.

How is this done? via a querystring? Are you using asp.net or asp?
 

emartel

Registered User.
Local time
Today, 10:12
Joined
Jan 15, 2005
Messages
48
Hi,
no, its in a "form method=post action=" set in html and asp:
the data that is in the hidden fields below is only displayed on the form it posts to (moredetails2.asp), but it only dissplaays the first word of that data:

do until rs.EOF
response.write("<tr align=center>")
Response.write("<td align=right valign=center bgcolor=#bbbbbb>")
Response.write("<form method=post action=MoreDetails2.asp><p><input type=hidden name=LongDesc value=" & rs.Fields("LongDesc")& ">" & "</p>")
Response.write("<input type=hidden size=50 name=price value=" & rs.fields("price") & ">")
Response.write("<input type=hidden size=50 name=imageloc value=" & rs.fields("imageloc") & ">")
Response.write("<input type=hidden size=50 name=glassname value=" & rs.fields("itemname") & ">")
 

dan-cat

Registered User.
Local time
Today, 18:12
Joined
Jun 2, 2002
Messages
3,433
I've just tested this with the following HTML...

Code:
 <form id="Form1" method="post" action="test2.aspx">
<INPUT type="hidden" value="my Test Value" id="txtTest" name="txtTest"><INPUT type="submit" value="Submit">
</form>

...and it worked fine. Maybe it is the size value pair that is trimming your string?
 

emartel

Registered User.
Local time
Today, 10:12
Joined
Jan 15, 2005
Messages
48
Hi, I'm afraid that's not it
I think the problem comes from the fact that the hidden value is stored in the database; if I change the input type to a text box, it still only shows up to the first space.
It cant be the length restriction (unnecessary as it is), as if I typed in "my test value" instead of "my test value" into the database field, it would display the text normally (as "my test value"). That led me to think that I had to put <p> or <tr> tags around it, but that didn't work, nor did "%>My test value<%"

thanks anyhow,
 

dan-cat

Registered User.
Local time
Today, 18:12
Joined
Jun 2, 2002
Messages
3,433
Try hardcoding a hidden input control like I did and see if that works.

If so then compare the html of your response.write control to the hard-coded one. To see if there is any difference...
 

emartel

Registered User.
Local time
Today, 10:12
Joined
Jan 15, 2005
Messages
48
Hi, thanks.
right,
I did that, giving it the value 'my test value' and it only displayed up until the space. entering 'my Test Value' as the value brings up 'my test value' as the response.
 

dan-cat

Registered User.
Local time
Today, 18:12
Joined
Jun 2, 2002
Messages
3,433
emartel said:
Hi, thanks.
right,
I did that, giving it the value 'my test value' and it only displayed up until the space. entering 'my Test Value' as the value brings up 'my test value' as the response.

ok that weird - 'cos it worked for me.

What is the asp code in the second form that you are using to pull the data from this hidden field?
 

emartel

Registered User.
Local time
Today, 10:12
Joined
Jan 15, 2005
Messages
48
Yeah, the thing is tho' that mine are inside 'Response.write ("' and then the html. Apart from that fact, i's the same principle as Im using on jmail forms and the like elsewhere.
The code that retrieves the values is:

Response.write ("<tr>")
Response.write ("<td align=center><font face=times new roman size=5 color=#000000><b>" & Request.form("itemname")& "</b></font></td></tr>")
Response.write ("<tr><td align=center><img src=images/stock/shop2/" & Request.form("imageloc") & " alt=" & Request.form("itemname") & " - " & Request.form("price") & "></td></tr>")
Response.write ("<tr><td width=50% align=center><br>" & Request.form("longdesc") & "</td></tr>")
Response.write ("<tr><td align=center><br><b>" & Request.form("price")& "</b></td></tr>")
 

dan-cat

Registered User.
Local time
Today, 18:12
Joined
Jun 2, 2002
Messages
3,433
emartel said:
Response.write ("<tr>")
Response.write ("<td align=center><font face=times new roman size=5 color=#000000><b>" & Request.form("itemname")& "</b></font></td></tr>")
Response.write ("<tr><td align=center><img src=images/stock/shop2/" & Request.form("imageloc") & " alt=" & Request.form("itemname") & " - " & Request.form("price") & "></td></tr>")
Response.write ("<tr><td width=50% align=center><br>" & Request.form("longdesc") & "</td></tr>")
Response.write ("<tr><td align=center><br><b>" & Request.form("price")& "</b></td></tr>")

Ok its to do with your IMG tag - you haven't enclosed the elements of your IMG tag with quotation marks. So when a space occurs it thinks that is the end of the element.


Should be something more like...

<img src='images/stock/shop2/" & Request.form("imageloc") & '" alt='" & Request.form("itemname") & " - " & Request.form("price") & "'>
 

emartel

Registered User.
Local time
Today, 10:12
Joined
Jan 15, 2005
Messages
48
Hi, I kind of see wht you mean, and Ill have to play around with it and see if I can get it to work.
thank you very much for your help !!
 

emartel

Registered User.
Local time
Today, 10:12
Joined
Jan 15, 2005
Messages
48
I see, so the apostrophe has to replace the quote mark.
excellent,
thanksvery much!!
 

Users who are viewing this thread

Top Bottom