Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
NEWBIE eruby basic form problem
Peter Woodsky
8/12/2008 12:18:00 AM
I'm trying to capture comments from a textarea field to add to a
database but I cannot figure out how to deal with escaping the data.
<form action="review.rhtml" method="post">
<input type="hidden" name="date" value="<%=today%>">
<label for="comment">Your Comment:</label>
<br>
<textarea name="comment" cols="60" rows="5"></textarea>
<p><input type="submit" value="Submit Review"></p>
</form>
Is there something I can do to "<%=comment%>" to handle '' "" etc.
Many thanks any help is appreciated
--
Posted via
http://www.ruby-...
.
2 Answers
Casimir
8/12/2008 8:44:00 AM
0
Peter Woodsky kirjoitti:
> I'm trying to capture comments from a textarea field to add to a
> database but I cannot figure out how to deal with escaping the data.
>
> <form action="review.rhtml" method="post">
> <input type="hidden" name="date" value="<%=today%>">
> <label for="comment">Your Comment:</label>
> <br>
> <textarea name="comment" cols="60" rows="5"></textarea>
> <p><input type="submit" value="Submit Review"></p>
> </form>
> Is there something I can do to "<%=comment%>" to handle '' "" etc.
>
> Many thanks any help is appreciated
You can escape characters in several different ways. The CGI class is
handy here, too. Example follows:
require 'cgi'
puts CGI.escape("black/white")
You can also unescape strings, and so forth. See the docs at
http://ruby-doc.org/core/classe...
It there is some string in particular you are looking for, you can
search for it with include?, and so on, using the String class, see docs
here:
http://www.ruby-doc.org/core/classes/S...
Did you have a more specific problem in mind?
Casimir Pohjanraito
Peter Woodsky
8/12/2008 12:26:00 PM
0
Casimir wrote:
> Peter Woodsky kirjoitti:
>> Is there something I can do to "<%=comment%>" to handle '' "" etc.
>>
>> Many thanks any help is appreciated
>
> You can escape characters in several different ways. The CGI class is
> handy here, too. Example follows:
>
> require 'cgi'
> puts CGI.escape("black/white")
>
> You can also unescape strings, and so forth. See the docs at
>
http://ruby-doc.org/core/classe...
>
> It there is some string in particular you are looking for, you can
> search for it with include?, and so on, using the String class, see docs
> here:
>
http://www.ruby-doc.org/core/classes/S...
>
> Did you have a more specific problem in mind?
>
>
> Casimir Pohjanraito
Casimir
Thanks for the tips. You gave me enough of a hint to to solve most of
the problem. There still seems to be a problem with characters like %
Regards,
Peter
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
NEWBIE eruby basic form problem
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password