[FX.php List] OT: LAJAX and &

Alex Gates alex at gandrpublishing.com
Wed Jul 11 20:46:34 MDT 2007


Hi everyone - 

I use LAJAX for a simple discussion board, and noticed a few posts oddly cut
off. 

 

We soon realized that the & symbol will cause your text string to be
truncated at the & when using LAJAX as a get or a post.

 

If you are using LAJAX, you may want to apply a little fix I hacked together
this morning.  I'm sure this could be coded more efficiently, (as I'm not
much of javascript guy) - but this seems to work.

 

function fix(){

var original=document.formname['formfield'].value;

var fixed=original.replace(/&/g,"and");

document.formname['formfield'].value=fixed;

}

Then, in your lajax call..

 

onclick="fix();javascript:LAJAX.post(..etc.

 

This will replace & with and - and will prevent the string from getting
chopped off.

 

I know I know, I should be using prototype - but if any of you are like me
and using LAJAX, perhaps you may find this useful. - if anything, it may be
good for the archives.

 

Alex

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20070711/8a22eff3/attachment.html


More information about the FX.php_List mailing list