Your function works. How/when are you firing it?

the following responds as expected.

<script type="text/javascript">
function cleanQuestion(str) {
 var myReturn = str.replace(/^\?/, '&#63;');
 return myReturn;
 }

 alert('?');
 alert(cleanQuestion('?'));
</script>

but why not use encodeURI?
http://www.w3schools.com/jsref/jsref_encodeURI.asp





On Jul 1, 2:31 am, BeeRich <[EMAIL PROTECTED]> wrote:
> Hi folks.
>
> I have a form submission that might take a question mark as part of a
> field.  Of course, setting the params variable for an ajax.request
> will essentially screw it up due to the second question mark in the
> params string.
>
> So I went to regexp and made this function:
>
> function cleanQuestion(str) {
>         /*              Returns a string with question marks as $#63;         
>   */
>         var myReturn = str.replace(/^\?/, '&#63;');
>         return myReturn;
>
>         }
>
> The problem is, it still shows up as a question mark.
>
> Anybody know how to get around this?
>
> 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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to