Subject: corrupt string after a Request.Form...
Posted By: johnjohn Post Date: 11/10/2004 12:08:09 PM
I have a Hidden input like this

<INPUT TYPE='HIDDEN' NAME='criteria' VALUE= '" & strCriteria & ">"

Where strCriteria is a string containing the criteria for a filter

it kind of look like

firstField LIKE 'something' AND secondField LIKE 'somethingElse'

But after the code here
strTemp = Request.Form("criteria")

strTemp only return: firstField LIKE

I kind of loose a part of the string

Why???

Thank you very much again for spending time to answer my question

Johnjohn


Reply By: ChrisScott Reply Date: 11/10/2004 12:18:04 PM
Hi johnjohn,

The single quote in your value is closing the value attribute of the input field & the rest is getting ignored.

One way to solve it would be to use double quotes around your attribute values and encode the value...

"<input type=""hidden"" name=""criteria"" value=""" & Server.HTMLEncode(strCriteria) & """>"

HTH,

Chris

Reply By: doosti Reply Date: 11/10/2004 4:31:18 PM
What i think it should go like this:

<INPUT TYPE="HIDDEN" NAME="criteria" VALUE= '" & strCriteria & "'>"

It must display your full string! :)




Farzan Q.
BS(TeleCommunication)
Iqra University.
Reply By: happygv Reply Date: 11/14/2004 11:32:48 PM
Farzan,

That wouldn't work the way it was expected, as it still uses single quotes around the string. Chris's solution would solve that. Else John should use DOUBLE quotes around the string in the VALUE attribute. Something like this...
Response.write "<INPUT TYPE=""HIDDEN"" NAME=""criteria"" VALUE= """ & strCriteria & """>"
Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection

Go to topic 21942

Return to index page 716
Return to index page 715
Return to index page 714
Return to index page 713
Return to index page 712
Return to index page 711
Return to index page 710
Return to index page 709
Return to index page 708
Return to index page 707