dissapearing leading and trailing blanks in textbox

Thread Solved

Join Date: May 2009
Posts: 18
Reputation: jimib is an unknown quantity at this point 
Solved Threads: 1
jimib jimib is offline Offline
Newbie Poster

dissapearing leading and trailing blanks in textbox

 
0
  #1
Oct 21st, 2009
could be this is an HTML problem, but I'll take the help anywhere I can find it...

  1. <%
  2. @ Page Language = "VB" aspcompat=true Explicit="True"
  3. Dim src As String = " bet "
  4. %>
  5.  
  6. <html>
  7. <head ></head>
  8. <body >
  9.  
  10. <form name=loc action=testsac.aspx method=get>
  11. <table class=s0 width=100% cellpadding=1 cellspacing=1 align=center border=1>
  12. <tr class=s0 align=center>
  13. <td>
  14. Search For:
  15. <input class=s0 size=50 name=src value=<%=src%>>
  16. <input class=s0 type=submit value=Search />
  17. <td></td>
  18. </tr>
  19. </table>
  20. </form>
  21.  
  22. </body>
  23. </html>

on the screen, "bet" is the search string, but I want " bet "
any ideas?
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 12
Reputation: sinnerFA is an unknown quantity at this point 
Solved Threads: 3
sinnerFA sinnerFA is offline Offline
Newbie Poster
 
0
  #2
Oct 21st, 2009
Try this:

  1. Dim src As String = Chr(32) & "bet" & Chr(32)

Not sure if it will solve your problem, but it appears as though it is being trimmed (trim())...
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 18
Reputation: jimib is an unknown quantity at this point 
Solved Threads: 1
jimib jimib is offline Offline
Newbie Poster
 
0
  #3
Oct 21st, 2009
Originally Posted by sinnerFA View Post
Try this:

  1. Dim src As String = Chr(32) & "bet" & Chr(32)

Not sure if it will solve your problem, but it appears as though it is being trimmed (trim())...
No, really it's a variable, which may or may not contain the leading and trailing spaces. When you assign as the value of a textbox, it is automatically trimmed. I'm looking for some kind of way to override that and leave the blanks in there.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 12
Reputation: sinnerFA is an unknown quantity at this point 
Solved Threads: 3
sinnerFA sinnerFA is offline Offline
Newbie Poster
 
1
  #4
Oct 21st, 2009
Okay I see your issue now...

  1. <html>
  2. <head ></head>
  3. <body >
  4.  
  5. <form name=loc action=testsac.aspx method=get>
  6. <table class=s0 width=100% cellpadding=1 cellspacing=1 align=center border=1>
  7. <tr class=s0 align=center>
  8. <td>
  9. Search For:
  10. <input class=s0 size=50 name=src value="&nbsp;<%=src %>&nbsp;">
  11. <input class=s0 type=submit value=Search />
  12. <td></td>
  13. </tr>
  14. </table>
  15. </form>
  16.  
  17. </body>
  18. </html>

It worked for me in Firefox 3.5
Last edited by sinnerFA; Oct 21st, 2009 at 8:14 pm.
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 18
Reputation: jimib is an unknown quantity at this point 
Solved Threads: 1
jimib jimib is offline Offline
Newbie Poster
 
0
  #5
Oct 21st, 2009
I solved this problem myself.
The answer is:
  1. <input size=50 name=src value="<%=src%>">
instead of
  1. <input size=50 name=src value=<%=src%>>
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the ASP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC