template rendering problem with g:each loop

krusekmn

New member
I have a template that is display a form for each iteration of the g:each. However on the first iteration the form is not rendered properly. The rest are all correct.

Code:
<g:each in="${rs1}">
			<g:form action="toRenew">
                         ${it.menaml} 
			<input type="hidden" name="memberNumber" value="${it?.MEMEMB}" />
			<g:submitToRemote action="addto" update="[success:'toRenew',failure:'error']" value="Renew"/>
			</g:form>
			
			
</g:each>

Here is what gets rendered:
<div id="updateMe">
Test Elaine M
<input type="hidden" value="7367608" name="memberNumber">
<input type="button" value="Renew" onclick="new Ajax.Updater({success:'toRenew',failure:'error'},'/renew/c1/addto',{asynchronous:true,evalScripts:true,parameters:Form.serialize(this.form)});return false">
<form method="post" action="/renew/c1/toRenew">
Test Kruse Test Kruse
<input type="hidden" value="7422318" name="memberNumber">
<input type="button" value="Renew" onclick="new Ajax.Updater({success:'toRenew',failure:'error'},'/renew/c1/addto',{asynchronous:true,evalScripts:true,parameters:Form.serialize(this.form)});return false">
</form>
<form method="post" action="/renew/c1/toRenew">
Testa Karen
<input type="hidden" value="7434681" name="memberNumber">
<input type="button" value="Renew" onclick="new Ajax.Updater({success:'toRenew',failure:'error'},'/renew/c1/addto',{asynchronous:true,evalScripts:true,parameters:Form.serialize(this.form)});return false">
</form>
<form method="post" action="/renew/c1/toRenew">
Tester Betty J
<input type="hidden" value="7353394" name="memberNumber">
<input type="button" value="Renew" onclick="new Ajax.Updater({success:'toRenew',failure:'error'},'/renew/c1/addto',{asynchronous:true,evalScripts:true,parameters:Form.serialize(this.form)});return false">
</form>
</div>

Any idea as to why this template would not render correctly?
 

dave

Administrator
Staff member
That sure looks odd behaviour, did you discover what caused it yet?
 

krusekmn

New member
Yes, I had a form around the ajax update div where the template was being rendered. Since there was a form in the template as well it created a nested form situation. Nested forms are not supported in html. My bad!

Since I am using ajax and updating an session arraylist I was able to move the outside form below the ajax update div and all is well.
 

dave

Administrator
Staff member
Yeah that'll get ya !

Thanks for updating us with the resolution :)
 
Top