Hi folks. I''m having some issues with a textarea that isn''t
holding
its carriage returns (''\r'') passed through to my middleware.
For
instance, if someone has 2 paragraphs, they end up being passed inline
as one single paragraph. I''m grabbing the value instead of parsing the
whole form, which is just a single textarea anyway:
var myComment = myForm.myComment.value;
How can I make sure the \r''s are returned properly into the var, and
furthermore into the ajax.updater?
Cheers
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
Hey there! BeeRich a écrit :> var myComment = myForm.myComment.value; > > How can I make sure the \r''s are returned properly into the var, and > furthermore into the ajax.updater?I have never seen a value property for a textarea stripping off carriage returns. Could you do these two things please: 1) specify your platform, browser and Prototype versions 2) put up a minimal reproduceable case for us to tinker with? -- Christophe Porteneuve a.k.a. TDD "[They] did not know it was impossible, so they did it." --Mark Twain Email: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Firefox on Mac OS X Tiger, using Prototype 1.4. As for the reproduceable case, that would take me most of today to rip out an action. The best I can do is describe it. Exactly like this Google groups window I''m typing in now. I enter my paragraphs, then she gets put into the database without any new paragraphs (\r). I''m reviewing my code and this is how it happens: var myComment = myForm.myComment.value; That takes the value of the textarea. I build my url for an ajax.updater: var myURL = ''includes/locRef.rbf?p=postLocComment&postid='' + postID + ''&userid='' + userID + ''&comment='' + myComment; I''m currently testing to see how the value is passed into my middleware. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
OK here''s the deal... After the var is set, I return it in an alert, and she displays properly. Then I build the url, accept it as a variable set to the parameter. The variable doesn''t show any breaks whatsoever. So somewhere in all that, any paragraph integrity is lost. var myComment = myForm.myComment.value; var myURL = ''includes/locRef.rbf?p=postLocComment&postid='' + postID + ''&userid='' + userID + ''&comment='' + myComment; --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Hi BeeRich, You could try sending the parameters by POST instead if GET. Also try to url-encode the data using encodeURIComponent(). HTH, Miguel BeeRich wrote:> OK here''s the deal... > > After the var is set, I return it in an alert, and she displays > properly. Then I build the url, accept it as a variable set to the > parameter. The variable doesn''t show any breaks whatsoever. So > somewhere in all that, any paragraph integrity is lost. > > var myComment = myForm.myComment.value; > var myURL = ''includes/locRef.rbf?p=postLocComment&postid='' + postID + > ''&userid='' + userID + ''&comment='' + myComment; > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I am using a post method:
new Ajax.Updater(
'''',
myURL,
{method:''post''}
);
I''m not sure what you mean by encodeURIComponent(). Any links?
Cheers
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
Hi again,
Yes, you are using the post method, but are not passing the parameters
in the post body.
Try using...
var myURL = ''includes/locRef.rbf'';
var params =
''p=''+postLocComment+''&postid='' + postID
+ ''&userid='' +
userID + ''&comment='' + myComment;
new Ajax.Updater(
'''',
myURL,
{method:''post'',parameters:params}
);
encodeURIComponent() is a native JavaScript command to URL-encode
strings so they can be passed in a URL.
It''s not necessary to use it for strings in the post body, but I just
got used to always encode al string before sending them to the server.
For further information about Ajax requests with prototype have a look
at http://prototypejs.org/learn/introduction-to-ajax
Miguel
BeeRich wrote:> I am using a post method:
>
> new Ajax.Updater(
> '''',
> myURL,
> {method:''post''}
> );
>
> I''m not sure what you mean by encodeURIComponent(). Any links?
>
> Cheers
>
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
So what is the difference? All my others have worked. Will that clip out \r''s? Cheers. I''ll take a look at the new docs. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Update: She works. So the passing of params into the params var into the ajax.updater, is completey different than just building a full url. Cheers --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---