Forum: Rails Spinoffs (closed, excessive spam) PeriodicalUpdater bug when returning HTML with <form> tag

Posted by a stembridge (Guest)
on 2008-06-19 23:32
(Received via mailing list)
Hi,

I'm using PeriodicalUpdater to display a short HTML form in simple web
page.

<script type='text/javascript' language='JavaScript'>
  new Ajax.PeriodicalUpdater('div_id', 'data.php',
  {
    method: 'post',
    frequency: 5,
    decay: 1,
    parameters: {id: 123, foo: 'bar'}
  });
</script>

<div id='div_id'></div>

The server file data.php returns the following HTML:

echo "<form method='post' action='submit_data.php'>
<input type='hidden' name='foo' value='RAB'>
  <input type='submit' name='sub' value='Submit Me!'>
</form>";

So - when I access the page with PeriodicalUpdater, the form is not
displayed.  No javascript errors, no php errors - nothing.

If I change the <form></form> tags to <foo_form></foo_form>, the form
displays in the div_id block as it should.

Is there a reason I can't return HTML with <form> tags?
Posted by T.J. Crowder (Guest)
on 2008-06-20 08:37
(Received via mailing list)
Hi,

No reason that I can see, no.  Your example works fine for me on IE6,
FF3, Safari 3.1, and Opera 9, all on Windows XP.  This suggests
there's something "special" about the surroundings around div_id in
your page.

Try creating a complete pared-down example page.  If you don't find
the problem just in the process of doing that (you probably will), you
can post it on http://pastie.org and link to it from this thread, and
someone will probably see what's going on.  Also let us know what your
environment is (browser, OS)...

Good luck,
--
T.J. Crowder
tj / crowder software / com
Posted by Matt Foster (Guest)
on 2008-06-20 22:14
(Received via mailing list)
Watch your HTML, those input objects are malformed, don't forget the
closing tags on simple <nodes/>

--
Matt Foster
Ajax Engineer
Nth Penguin, LLC
http://www.nthpenguin.com
This topic is locked and can not be replied to.