RJS doesn't output correctly

Hello,

I was trying to output a partial with RJS and this is what its returning
me as response:

try {
Element.update("countView", "\074p\076\n\074form method=\"POST\"
action=\"search_date\"\076\n \074table align=\"center\"
bgcolor=\"#FFFFFF\" cellspacing=0 cellpadding=0\076\n
\074tr\076\n \074td bgcolor=\"#0066CC\"
colspan=3\076\074b\076View - Counts By Date:\074/b\076\074/td\076\n
\074/tr\076\n \074tr\076\n \074td\076\074select
id=\"date_month\" name=\"date[month]\"\076\n\074option value=\"1\"
selected=\"selected\"\0761\074/option\076\n\074option
value=\"2\"\0762\074/option\076\n\074option
value=\"3\"\0763\074/option\076\n\074option
value=\"4\"\0764\074/option\076\n\074option
value=\"5\"\0765\074/option\076\n\074option
value=\"6\"\0766\074/option\076\n\074option
value=\"7\"\0767\074/option\076\n\074option
value=\"8\"\0768\074/option\076\n\074option
value=\"9\"\0769\074/option\076\n\074option
value=\"10\"\07610\074/option\076\n\074option
value=\"11\"\07611\074/option\076\n\074option
value=\"12\"\07612\074/option\076\n\074/select\076\n/\074select
id=\"date_day\" name=\"date[day]\"\076\n\074option
value=\"1\"\0761\074/option\076\n\074option
value=\"2\"\0762\074/option\076\n\074option
value=\"3\"\0763\074/option\076\n\074option
value=\"4\"\0764\074/option\076\n\074option
value=\"5\"\0765\074/option\076\n\074option
value=\"6\"\0766\074/option\076\n\074option
value=\"7\"\0767\074/option\076\n\074option value=\"8\"
selected=\"selected\"\0768\074/option\076\n\074option
value=\"9\"\0769\074/option\076\n\074option
value=\"10\"\07610\074/option\076\n\074option
value=\"11\"\07611\074/option\076\n\074option
value=\"12\"\07612\074/option\076\n\074option
value=\"13\"\07613\074/option\076\n\074option
value=\"14\"\07614\074/option\076\n\074option
value=\"15\"\07615\074/option\076\n\074option
value=\"16\"\07616\074/option\076\n\074option
value=\"17\"\07617\074/option\076\n\074option
value=\"18\"\07618\074/option\076\n\074option
value=\"19\"\07619\074/option\076\n\074option
value=\"20\"\07620\074/option\076\n\074option
value=\"21\"\07621\074/option\076\n\074option
value=\"22\"\07622\074/option\076\n\074option
value=\"23\"\07623\074/option\076\n\074option
value=\"24\"\07624\074/option\076\n\074option
value=\"25\"\07625\074/option\076\n\074option
value=\"26\"\07626\074/option\076\n\074option
value=\"27\"\07627\074/option\076\n\074option
value=\"28\"\07628\074/option\076\n\074option
value=\"29\"\07629\074/option\076\n\074option
value=\"30\"\07630\074/option\076\n\074option
value=\"31\"\07631\074/option\076\n\074/select\076\n/\074select
id=\"date_year\" name=\"date[year]\"\076\n\074option
value=\"2000\"\0762000\074/option\076\n\074option
value=\"2001\"\0762001\074/option\076\n\074option
value=\"2002\"\0762002\074/option\076\n\074option
value=\"2003\"\0762003\074/option\076\n\074option
value=\"2004\"\0762004\074/option\076\n\074option
value=\"2005\"\0762005\074/option\076\n\074option
value=\"2006\"\0762006\074/option\076\n\074option
value=\"2007\"\0762007\074/option\076\n\074option value=\"2008\"
selected=\"selected\"\0762008\074/option\076\n\074option
value=\"2009\"\0762009\074/option\076\n\074option
value=\"2010\"\0762010\074/option\076\n\074option
value=\"2011\"\0762011\074/option\076\n\074option
value=\"2012\"\0762012\074/option\076\n\074option
value=\"2013\"\0762013\074/option\076\n\074option
value=\"2014\"\0762014\074/option\076\n\074option
value=\"2015\"\0762015\074/option\076\n\074option
value=\"2016\"\0762016\074/option\076\n\074option
value=\"2017\"\0762017\074/option\076\n\074option
value=\"2018\"\0762018\074/option\076\n\074option
value=\"2019\"\0762019\074/option\076\n\074option
value=\"2020\"\0762020\074/option\076\n\074option
value=\"2021\"\0762021\074/option\076\n\074option
value=\"2022\"\0762022\074/option\076\n\074option
value=\"2023\"\0762023\074/option\076\n\074option
value=\"2024\"\0762024\074/option\076\n\074option
value=\"2025\"\0762025\074/option\076\n\074option
value=\"2026\"\0762026\074/option\076\n\074option
value=\"2027\"\0762027\074/option\076\n\074option
value=\"2028\"\0762028\074/option\076\n\074option
value=\"2029\"\0762029\074/option\076\n\074option
value=\"2030\"\0762030\074/option\076\n\074/select\076\n\074/td\076\074td\076 To \074/td\076\074td\076\074select
id=\"date_month2\" name=\"date[month2]\"\076\n\074option value=\"1\"
selected=\"selected\"\0761\074/option\076\n\074option
value=\"2\"\0762\074/option\076\n\074option
value=\"3\"\0763\074/option\076\n\074option
value=\"4\"\0764\074/option\076\n\074option
value=\"5\"\0765\074/option\076\n\074option
value=\"6\"\0766\074/option\076\n\074option
value=\"7\"\0767\074/option\076\n\074option
value=\"8\"\0768\074/option\076\n\074option
value=\"9\"\0769\074/option\076\n\074option
value=\"10\"\07610\074/option\076\n\074option
value=\"11\"\07611\074/option\076\n\074option
value=\"12\"\07612\074/option\076\n\074/select\076\n/\074select
id=\"date_day2\" name=\"date[day2]\"\076\n\074option
value=\"1\"\0761\074/option\076\n\074option
value=\"2\"\0762\074/option\076\n\074option
value=\"3\"\0763\074/option\076\n\074option
value=\"4\"\0764\074/option\076\n\074option
value=\"5\"\0765\074/option\076\n\074option
value=\"6\"\0766\074/option\076\n\074option
value=\"7\"\0767\074/option\076\n\074option value=\"8\"
selected=\"selected\"\0768\074/option\076\n\074option
value=\"9\"\0769\074/option\076\n\074option
value=\"10\"\07610\074/option\076\n\074option
value=\"11\"\07611\074/option\076\n\074option
value=\"12\"\07612\074/option\076\n\074option
value=\"13\"\07613\074/option\076\n\074option
value=\"14\"\07614\074/option\076\n\074option
value=\"15\"\07615\074/option\076\n\074option
value=\"16\"\07616\074/option\076\n\074option
value=\"17\"\07617\074/option\076\n\074option
value=\"18\"\07618\074/option\076\n\074option
value=\"19\"\07619\074/option\076\n\074option
value=\"20\"\07620\074/option\076\n\074option
value=\"21\"\07621\074/option\076\n\074option
value=\"22\"\07622\074/option\076\n\074option
value=\"23\"\07623\074/option\076\n\074option
value=\"24\"\07624\074/option\076\n\074option
value=\"25\"\07625\074/option\076\n\074option
value=\"26\"\07626\074/option\076\n\074option
value=\"27\"\07627\074/option\076\n\074option
value=\"28\"\07628\074/option\076\n\074option
value=\"29\"\07629\074/option\076\n\074option
value=\"30\"\07630\074/option\076\n\074option
value=\"31\"\07631\074/option\076\n\074/select\076\n/\074select
id=\"date_year2\" name=\"date[year2]\"\076\n\074option
value=\"2000\"\0762000\074/option\076\n\074option
value=\"2001\"\0762001\074/option\076\n\074option
value=\"2002\"\0762002\074/option\076\n\074option
value=\"2003\"\0762003\074/option\076\n\074option
value=\"2004\"\0762004\074/option\076\n\074option
value=\"2005\"\0762005\074/option\076\n\074option
value=\"2006\"\0762006\074/option\076\n\074option
value=\"2007\"\0762007\074/option\076\n\074option value=\"2008\"
selected=\"selected\"\0762008\074/option\076\n\074option
value=\"2009\"\0762009\074/option\076\n\074option
value=\"2010\"\0762010\074/option\076\n\074option
value=\"2011\"\0762011\074/option\076\n\074option
value=\"2012\"\0762012\074/option\076\n\074option
value=\"2013\"\0762013\074/option\076\n\074option
value=\"2014\"\0762014\074/option\076\n\074option
value=\"2015\"\0762015\074/option\076\n\074option
value=\"2016\"\0762016\074/option\076\n\074option
value=\"2017\"\0762017\074/option\076\n\074option
value=\"2018\"\0762018\074/option\076\n\074option
value=\"2019\"\0762019\074/option\076\n\074option
value=\"2020\"\0762020\074/option\076\n\074option
value=\"2021\"\0762021\074/option\076\n\074option
value=\"2022\"\0762022\074/option\076\n\074option
value=\"2023\"\0762023\074/option\076\n\074option
value=\"2024\"\0762024\074/option\076\n\074option
value=\"2025\"\0762025\074/option\076\n\074option
value=\"2026\"\0762026\074/option\076\n\074option
value=\"2027\"\0762027\074/option\076\n\074option
value=\"2028\"\0762028\074/option\076\n\074option
value=\"2029\"\0762029\074/option\076\n\074option
value=\"2030\"\0762030\074/option\076\n\074/select\076\n\074/td\076\n
\074tr\076\n \074tr\076\n \074td
colspan=3\076\074input type=\"submit\" id=\"SubmitDate\" value=\"Get
Count\"/\076\074/td\076\n \074/tr\076\n \074/table\076\n
\074/form\076\n\n\074input type=\"hidden\" value=\"4\"/\076\n\n\074div
id=\"countToday\"\076\n\074table align=\"center\" cellspacing=\"1\"
border=\"0\"\076\n \074tr\076\n \074td
colspan=\"5\" bgcolor=\"#ECECEC\"\076\074b\076Pex - DMO List Count
2008-01-08\074/b\076\074/td\076\n \074/tr\076\n
\074tr\076\n \074td
bgcolor=\"#0066CC\"\076\074b\076List\074/b\076\074/td\076\074td
bgcolor=\"#0066CC\"\076\074b\076Total\074/b\076\074/td\076\n
\074/tr\076\n \074tr bgcolor=\"#FFFFFF\"\076\n
\074td\076\074b\076DMO\074/b\076\074/td\076\074td\0760\074/td\076\n
\074/tr\076\n \n \074/table\076\n\074/div\076\n\074/p\076\n");
} catch (e) { alert('RJS error:\n\n' + e.toString());
alert('Element.update(\"countView\", \"\\074p\\076\\n\\074form
method=\\\"POST\\\" action=\\\"search_date\\\"\\076\\n \\074table
align=\\\"center\\\" bgcolor=\\\"#FFFFFF\\\" cellspacing=0
cellpadding=0\\076\\n \\074tr\\076\\n \\074td
bgcolor=\\\"#0066CC\\\" colspan=3\\076\\074b\\076View Pex - DMO Counts
By Date:\\074/b\\076\\074/td\\076\\n \\074/tr\\076\\n
\\074tr\\076\\n \\074td\\076\\074select
id=\\\"date_month\\\" name=\\\"date[month]\\\"\\076\\n\\074option
value=\\\"1\\\"
selected=\\\"selected\\\"\\0761\\074/option\\076\\n\\074option
value=\\\"2\\\"\\0762\\074/option\\076\\n\\074option
value=\\\"3\\\"\\0763\\074/option\\076\\n\\074option
value=\\\"4\\\"\\0764\\074/option\\076\\n\\074option
value=\\\"5\\\"\\0765\\074/option\\076\\n\\074option
value=\\\"6\\\"\\0766\\074/option\\076\\n\\074option
value=\\\"7\\\"\\0767\\074/option\\076\\n\\074option
value=\\\"8\\\"\\0768\\074/option\\076\\n\\074option
value=\\\"9\\\"\\0769\\074/option\\076\\n\\074option
value=\\\"10\\\"\\07610\\074/option\\076\\n\\074option
value=\\\"11\\\"\\07611\\074/option\\076\\n\\074option
value=\\\"12\\\"\\07612\\074/option\\076\\n\\074/select\\076\\n/\\074select
id=\\\"date_day\\\" name=\\\"date[day]\\\"\\076\\n\\074option
value=\\\"1\\\"\\0761\\074/option\\076\\n\\074option
value=\\\"2\\\"\\0762\\074/option\\076\\n\\074option
value=\\\"3\\\"\\0763\\074/option\\076\\n\\074option
value=\\\"4\\\"\\0764\\074/option\\076\\n\\074option
value=\\\"5\\\"\\0765\\074/option\\076\\n\\074option
value=\\\"6\\\"\\0766\\074/option\\076\\n\\074option
value=\\\"7\\\"\\0767\\074/option\\076\\n\\074option value=\\\"8\\\"
selected=\\\"selected\\\"\\0768\\074/option\\076\\n\\074option
value=\\\"9\\\"\\0769\\074/option\\076\\n\\074option
value=\\\"10\\\"\\07610\\074/option\\076\\n\\074option
value=\\\"11\\\"\\07611\\074/option\\076\\n\\074option
value=\\\"12\\\"\\07612\\074/option\\076\\n\\074option
value=\\\"13\\\"\\07613\\074/option\\076\\n\\074option
value=\\\"14\\\"\\07614\\074/option\\076\\n\\074option
value=\\\"15\\\"\\07615\\074/option\\076\\n\\074option
value=\\\"16\\\"\\07616\\074/option\\076\\n\\074option
value=\\\"17\\\"\\07617\\074/option\\076\\n\\074option
value=\\\"18\\\"\\07618\\074/option\\076\\n\\074option
value=\\\"19\\\"\\07619\\074/option\\076\\n\\074option
value=\\\"20\\\"\\07620\\074/option\\076\\n\\074option
value=\\\"21\\\"\\07621\\074/option\\076\\n\\074option
value=\\\"22\\\"\\07622\\074/option\\076\\n\\074option
value=\\\"23\\\"\\07623\\074/option\\076\\n\\074option
value=\\\"24\\\"\\07624\\074/option\\076\\n\\074option
value=\\\"25\\\"\\07625\\074/option\\076\\n\\074option
value=\\\"26\\\"\\07626\\074/option\\076\\n\\074option
value=\\\"27\\\"\\07627\\074/option\\076\\n\\074option
value=\\\"28\\\"\\07628\\074/option\\076\\n\\074option
value=\\\"29\\\"\\07629\\074/option\\076\\n\\074option
value=\\\"30\\\"\\07630\\074/option\\076\\n\\074option
value=\\\"31\\\"\\07631\\074/option\\076\\n\\074/select\\076\\n/\\074select
id=\\\"date_year\\\" name=\\\"date[year]\\\"\\076\\n\\074option
value=\\\"2000\\\"\\0762000\\074/option\\076\\n\\074option
value=\\\"2001\\\"\\0762001\\074/option\\076\\n\\074option
value=\\\"2002\\\"\\0762002\\074/option\\076\\n\\074option
value=\\\"2003\\\"\\0762003\\074/option\\076\\n\\074option
value=\\\"2004\\\"\\0762004\\074/option\\076\\n\\074option
value=\\\"2005\\\"\\0762005\\074/option\\076\\n\\074option
value=\\\"2006\\\"\\0762006\\074/option\\076\\n\\074option
value=\\\"2007\\\"\\0762007\\074/option\\076\\n\\074option
value=\\\"2008\\\"
selected=\\\"selected\\\"\\0762008\\074/option\\076\\n\\074option
value=\\\"2009\\\"\\0762009\\074/option\\076\\n\\074option
value=\\\"2010\\\"\\0762010\\074/option\\076\\n\\074option
value=\\\"2011\\\"\\0762011\\074/option\\076\\n\\074option
value=\\\"2012\\\"\\0762012\\074/option\\076\\n\\074option
value=\\\"2013\\\"\\0762013\\074/option\\076\\n\\074option
value=\\\"2014\\\"\\0762014\\074/option\\076\\n\\074option
value=\\\"2015\\\"\\0762015\\074/option\\076\\n\\074option
value=\\\"2016\\\"\\0762016\\074/option\\076\\n\\074option
value=\\\"2017\\\"\\0762017\\074/option\\076\\n\\074option
value=\\\"2018\\\"\\0762018\\074/option\\076\\n\\074option
value=\\\"2019\\\"\\0762019\\074/option\\076\\n\\074option
value=\\\"2020\\\"\\0762020\\074/option\\076\\n\\074option
value=\\\"2021\\\"\\0762021\\074/option\\076\\n\\074option
value=\\\"2022\\\"\\0762022\\074/option\\076\\n\\074option
value=\\\"2023\\\"\\0762023\\074/option\\076\\n\\074option
value=\\\"2024\\\"\\0762024\\074/option\\076\\n\\074option
value=\\\"2025\\\"\\0762025\\074/option\\076\\n\\074option
value=\\\"2026\\\"\\0762026\\074/option\\076\\n\\074option
value=\\\"2027\\\"\\0762027\\074/option\\076\\n\\074option
value=\\\"2028\\\"\\0762028\\074/option\\076\\n\\074option
value=\\\"2029\\\"\\0762029\\074/option\\076\\n\\074option
value=\\\"2030\\\"\\0762030\\074/option\\076\\n\\074/select\\076\\n\\074/td\\076\\074td\\076 To \\074/td\\076\\074td\\076\\074select
id=\\\"date_month2\\\" name=\\\"date[month2]\\\"\\076\\n\\074option
value=\\\"1\\\"
selected=\\\"selected\\\"\\0761\\074/option\\076\\n\\074option
value=\\\"2\\\"\\0762\\074/option\\076\\n\\074option
value=\\\"3\\\"\\0763\\074/option\\076\\n\\074option
value=\\\"4\\\"\\0764\\074/option\\076\\n\\074option
value=\\\"5\\\"\\0765\\074/option\\076\\n\\074option
value=\\\"6\\\"\\0766\\074/option\\076\\n\\074option
value=\\\"7\\\"\\0767\\074/option\\076\\n\\074option
value=\\\"8\\\"\\0768\\074/option\\076\\n\\074option
value=\\\"9\\\"\\0769\\074/option\\076\\n\\074option
value=\\\"10\\\"\\07610\\074/option\\076\\n\\074option
value=\\\"11\\\"\\07611\\074/option\\076\\n\\074option
value=\\\"12\\\"\\07612\\074/option\\076\\n\\074/select\\076\\n/\\074select
id=\\\"date_day2\\\" name=\\\"date[day2]\\\"\\076\\n\\074option
value=\\\"1\\\"\\0761\\074/option\\076\\n\\074option
value=\\\"2\\\"\\0762\\074/option\\076\\n\\074option
value=\\\"3\\\"\\0763\\074/option\\076\\n\\074option
value=\\\"4\\\"\\0764\\074/option\\076\\n\\074option
value=\\\"5\\\"\\0765\\074/option\\076\\n\\074option
value=\\\"6\\\"\\0766\\074/option\\076\\n\\074option
value=\\\"7\\\"\\0767\\074/option\\076\\n\\074option value=\\\"8\\\"
selected=\\\"selected\\\"\\0768\\074/option\\076\\n\\074option
value=\\\"9\\\"\\0769\\074/option\\076\\n\\074option
value=\\\"10\\\"\\07610\\074/option\\076\\n\\074option
value=\\\"11\\\"\\07611\\074/option\\076\\n\\074option
value=\\\"12\\\"\\07612\\074/option\\076\\n\\074option
value=\\\"13\\\"\\07613\\074/option\\076\\n\\074option
value=\\\"14\\\"\\07614\\074/option\\076\\n\\074option
value=\\\"15\\\"\\07615\\074/option\\076\\n\\074option
value=\\\"16\\\"\\07616\\074/option\\076\\n\\074option
value=\\\"17\\\"\\07617\\074/option\\076\\n\\074option
value=\\\"18\\\"\\07618\\074/option\\076\\n\\074option
value=\\\"19\\\"\\07619\\074/option\\076\\n\\074option
value=\\\"20\\\"\\07620\\074/option\\076\\n\\074option
value=\\\"21\\\"\\07621\\074/option\\076\\n\\074option
value=\\\"22\\\"\\07622\\074/option\\076\\n\\074option
value=\\\"23\\\"\\07623\\074/option\\076\\n\\074option
value=\\\"24\\\"\\07624\\074/option\\076\\n\\074option
value=\\\"25\\\"\\07625\\074/option\\076\\n\\074option
value=\\\"26\\\"\\07626\\074/option\\076\\n\\074option
value=\\\"27\\\"\\07627\\074/option\\076\\n\\074option
value=\\\"28\\\"\\07628\\074/option\\076\\n\\074option
value=\\\"29\\\"\\07629\\074/option\\076\\n\\074option
value=\\\"30\\\"\\07630\\074/option\\076\\n\\074option
value=\\\"31\\\"\\07631\\074/option\\076\\n\\074/select\\076\\n/\\074select
id=\\\"date_year2\\\" name=\\\"date[year2]\\\"\\076\\n\\074option
value=\\\"2000\\\"\\0762000\\074/option\\076\\n\\074option
value=\\\"2001\\\"\\0762001\\074/option\\076\\n\\074option
value=\\\"2002\\\"\\0762002\\074/option\\076\\n\\074option
value=\\\"2003\\\"\\0762003\\074/option\\076\\n\\074option
value=\\\"2004\\\"\\0762004\\074/option\\076\\n\\074option
value=\\\"2005\\\"\\0762005\\074/option\\076\\n\\074option
value=\\\"2006\\\"\\0762006\\074/option\\076\\n\\074option
value=\\\"2007\\\"\\0762007\\074/option\\076\\n\\074option
value=\\\"2008\\\"
selected=\\\"selected\\\"\\0762008\\074/option\\076\\n\\074option
value=\\\"2009\\\"\\0762009\\074/option\\076\\n\\074option
value=\\\"2010\\\"\\0762010\\074/option\\076\\n\\074option
value=\\\"2011\\\"\\0762011\\074/option\\076\\n\\074option
value=\\\"2012\\\"\\0762012\\074/option\\076\\n\\074option
value=\\\"2013\\\"\\0762013\\074/option\\076\\n\\074option
value=\\\"2014\\\"\\0762014\\074/option\\076\\n\\074option
value=\\\"2015\\\"\\0762015\\074/option\\076\\n\\074option
value=\\\"2016\\\"\\0762016\\074/option\\076\\n\\074option
value=\\\"2017\\\"\\0762017\\074/option\\076\\n\\074option
value=\\\"2018\\\"\\0762018\\074/option\\076\\n\\074option
value=\\\"2019\\\"\\0762019\\074/option\\076\\n\\074option
value=\\\"2020\\\"\\0762020\\074/option\\076\\n\\074option
value=\\\"2021\\\"\\0762021\\074/option\\076\\n\\074option
value=\\\"2022\\\"\\0762022\\074/option\\076\\n\\074option
value=\\\"2023\\\"\\0762023\\074/option\\076\\n\\074option
value=\\\"2024\\\"\\0762024\\074/option\\076\\n\\074option
value=\\\"2025\\\"\\0762025\\074/option\\076\\n\\074option
value=\\\"2026\\\"\\0762026\\074/option\\076\\n\\074option
value=\\\"2027\\\"\\0762027\\074/option\\076\\n\\074option
value=\\\"2028\\\"\\0762028\\074/option\\076\\n\\074option
value=\\\"2029\\\"\\0762029\\074/option\\076\\n\\074option
value=\\\"2030\\\"\\0762030\\074/option\\076\\n\\074/select\\076\\n\\074/td\\076\\n
\\074tr\\076\\n \\074tr\\076\\n \\074td
colspan=3\\076\\074input type=\\\"submit\\\" id=\\\"SubmitDate\\\"
value=\\\"Get Count\\\"/\\076\\074/td\\076\\n \\074/tr\\076\\n
\\074/table\\076\\n \\074/form\\076\\n\\n\\074input type=\\\"hidden\\\"
value=\\\"4\\\"/\\076\\n\\n\\074div
id=\\\"countToday\\\"\\076\\n\\074table align=\\\"center\\\"
cellspacing=\\\"1\\\" border=\\\"0\\\"\\076\\n \\074tr\\076\\n
\\074td colspan=\\\"5\\\" bgcolor=\\\"#ECECEC\\\"\\076\\074b\\076 -
List Count 2008-01-08\\074/b\\076\\074/td\\076\\n
\\074/tr\\076\\n \\074tr\\076\\n
\\074td
bgcolor=\\\"#0066CC\\\"\\076\\074b\\076List\\074/b\\076\\074/td\\076\\074td
bgcolor=\\\"#0066CC\\\"\\076\\074b\\076Total\\074/b\\076\\074/td\\076\\n
\\074/tr\\076\\n \\074tr bgcolor=\\\"#FFFFFF\\\"\\076\\n
\\074td\\076\\074b\\076DMO\\074/b\\076\\074/td\\076\\074td\\0760\\074/td\\076\\n
\\074/tr\\076\\n \\n
\\074/table\\076\\n\\074/div\\076\\n\\074/p\\076\\n\");'); throw e }

Why is it outputting my partial like that?

Thanks
M

I was getting this earlier today, i removed the :update => 'xx' option
from the link_to_remote call and it worked fine (since you're probably
setting the update target in the rjs file anyway)

Hope this helps, try posting your code in future so it is easier to
assist!

Joe

Matthew Lagace wrote:

Well this is what I have in my .rjs:

page.replace_html 'countView', :partial => 'affcount'

And this is what I have in my partial:

<p>
<form method="POST" action="search_date">
  <table align="center" bgcolor="#FFFFFF" cellspacing=0 cellpadding=0>
        <tr>
                <td bgcolor="#0066CC" colspan=3><b>View <%= @system.name
%> - <%= @partnerName %> Counts By Date:</b></td>
        </tr>
        <tr>
                <td><%= select_month(Date.today, :use_month_numbers =>
true)%>/<%= select_day(Date.today)%>/<%= select_year(Date.today,
:start_year => 2000, :end_year =>
2030)%></td><td>&nbsp;To&nbsp;</td><td><%= select_month(Date.today,
:use_month_numbers => true, :field_name => 'month2')%>/<%=
select_day(Date.today, :field_name => 'day2')%>/<%=
select_year(Date.today, :start_year => 2000, :end_year => 2030,
:field_name => 'year2')%></td>
        <tr>
        <tr>
                <td colspan=3><input type="submit" id="SubmitDate"
value="Get Count"/></td>
        </tr>
  </table>
  </form>

<table align="center" cellspacing="1" border="0">
         <tr>
                        <td colspan="5" bgcolor="#ECECEC"><b><%=
@system.name %> - <%= @partnerName %> List Count <%= @dateToday
%></b></td>
                </tr>
                <tr>
                        <td bgcolor="#0066CC"><b>List</b></td><td
bgcolor="#0066CC"><b>Total</b></td>
                </tr>
                 <tr bgcolor="#FFFFFF">
                        <td><b><%= @partnerName %></b></td><td><%=
@total %></td>
                </tr>

        </table>
</p>

No, I think what Wildtangent meant was what do you have in the function that triggers the request to the RJS page?

I’ve also been getting this issue since upgrading to Rails 2. I’ve tried both rjs and js templates and both return javascript that does not eval.

Ok I found the source of my problem.

In my partial, and the page where I want to show my partial in, I had
the form tags like this:

<form method="POST" action="do_count">
    <input type="submit" id="Do Count" />
</form>

Then I tried just for fun to put my form tags like this:
<%= form_remote_tag :url => {:action => 'do_count'}, :html => {:id =>
'docount-form'} %>

<%= submit_tag 'Do Count' %>

<%= end_form_tag %>

I didn't change any code anywhere, I just changed the way I do the forms
and it worked!

Thanks for the help
M

Thanks for posting your solution. This doesn't work for me though,
anything (forms, observers, etc) that should return javascript to the
browser returns the code but it does not get executed.

I think this is Rails 2 specific, but from my searching on the web
others do not seem to be having problems like this.

Can you list the code your using, like rjs, partial, controller?

Hi Matthew

Here’s the form, I tried using the remote form and it didn’t make a difference, also this is just an autocomplete on the search term

Search:

Working...

I’ve added the javascript unobtrusively, but here’s the javascript that is called;

new Ajax.Autocompleter(‘search-term’, ‘search-results’, ‘/contacts/search’, {

method: ‘get’,

asynchrous: true,

evalScripts: true

});

Here’s the controller action:

def search

@search_term = params[:search_term] + “*”

@contacts = Contact.find_by_contents(@search_term)

respond_to do |format|

format.html

format.js

end

end

Here’s the rjs:

page[‘search-results’].replace_html :partial => ‘search_results’

Here’s the partial that is returned by the javascript:

    <% for contact in @contacts %>

  • <%= contact.full_name %>
  • <% end %>

And finally here’s the output from firebug when a success request is made:

try {

$(“search-results”).update("\u003Cul\u003E\n \n \u003Cli\u003EKieran Johnson\u003C/li\u003E\n \n\u003C/ul\u003E");

} catch (e) { alert(‘RJS error:\n\n’ + e.toString()); alert(’$(“search-results”).update("\u003Cul\u003E\n \n \u003Cli\u003EKieran Johnson\u003C/li\u003E\n \n\u003C/ul\u003E");’); throw e }

If I run this in Firebug the item is inserted. As I mention previously I had this happen each time I’ve tried to create an app with rails 2. If you can shed any light on the problem it would be fantastic.

Thanks

Kieran

Hey Kieran,

Instead of doing this:

<form id="search-form" action="/contacts/search" method="get">
      <p>
        <label for="search-term">Search: </label>
        <input type="text" id="search-term" name="search_term" />
        <img id="spinner" src="/images/spinner.gif" alt="Working..."
style="display: none" />
        <div id="search-results" class="autocomplete"></div>
        <input type="submit" value="Search" class="submit search">
      </p>
</form>

Why don't you do this:

<html>
<head>
      <title>Search</title>
</head>
<body>
<%= text_field_with_auto_complete :recipe (replace :recipe w/name of
your table), :name (replace :name with the table column you are doing
the search on) %>
</body>
</html>

Here's what you would do in the controller:

class SearchController < ApplicationController
   auto_complete_for :recipe, :name
end

This code will automatically fetch the results and give it to you in a
DHTML popup which can never be blocked by browsers.

or if you really want to use rjs you should have this instead:

page.replace_html 'search-results', :partial => 'search_results'

Regards
Matthew

I would use the helper by I need to search across a lot of fields, so I am doing this using Acts As Ferret. As I said before it works, its just the javascript does not eval.

I updated the rjs to reflect your suggestion, but its still a no go.