|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
When I pull information from my database, it is viewed in a form format. This way, the information can be edited easily.
I have written a function to make it possible to use apostrophes in the database BUT when I try to view the information in the form format (edit format), everything after the apostrophe is hidden. I have a understanding of what is going on. The apostrophe is making the browser think that the data ends there. How can I make the data after the apostrophe show up in the form field? Help!! Melanie ![]() |
|
#2
|
||||
|
||||
|
Post your code you are using to display the field.
|
|
#3
|
|||
|
|||
|
Quote:
Response.Write "<tr><td><b>Last Name:</b></td>" Response.Write "<td><input type='text' name='lastname' value='" & rsClient("LastName") & "' style='border:1px ridge #000080'></td></tr>" |
|
#4
|
||||
|
||||
|
Change this: Response.Write "<td><input type='text' name='lastname' value='" & rsClient("LastName") & "' style='border:1px ridge #000080'></td></tr>"
To: Code:
Response.Write "<td><input type='text' name='lastname' value='" & Replace(rsClient("LastName"),"'","'") & "' style='border:1px ridge #000080'></td></tr>"
This way you replace the single quote character into its corresponding html entity " And if you want to replace double qoute use Code:
Response.Write "<td><input type='text' name='lastname' value='" & Replace(rsClient("LastName"),"'",""") & "' style='border:1px ridge #000080'>
You can find out more about HTML entities at W3Schools Don't forget that where ' you need to add a ; right after it, for some reason, I can't display it right
__________________
................... ASCII and ye shall receive .................. Knowledge is the only resource on earth that multiplies when shared Support the Shemzilla Project Powered by C# |
|
#5
|
|||
|
|||
|
There is NO benifit in Response.writing your HTML, just use the HTML and insert ASP as needed. It's also a heck of a lot easier!
Code:
<tr><td><b>Last Name:</b></td>
<td><input type="text" name="lastname" value="<%=rsClient("LastName")%>" style="border:1px ridge #000080"></td></tr>
And for the record, when you need to represent a quotation in a string, you use a double quote "". So if you WERE to use the other code, which I don't recommend, it would have to be changed to: Code:
Response.Write "<td><input type=""text"" name=""lastname"" value=""" & rsClient("LastName") & """ style=""border:1px ridge #000080""></td></tr>"
You'll notice """ which means, show a " and then the 3rd one breaks the string so you can show the variable. |
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > Viewing DB Results with APOSTROPHE in Form Field |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|