You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Security Management <li...@secmgmt.com> on 2009/04/20 16:15:09 UTC

Help with dynamic form id

I have the following in a jsp, I'm creating hidden forms to submit with
javascript when someone clicks on a table row:

<s:iterator value="people">
	<s:set name="form_id" value="[0].id"/>
	<s:form id="#form_id" action="personProfile">
		<s:hidden theme="checkbox-fix" key="id"/>
	</s:form>
</s:iterator>

I get the following HTML generated:

<form id="_form_id" name="personProfile"
action="/smc-appsuite/my-employees/personProfile" method="post">
<table class="wwFormTable">
	<tr style="display: none"><td colspan="2">
	<input type="hidden" name="id" value="3"
id="_form_id_id"/>/></td></tr>
</table></form>

Is there any way to do it other than not using s:form and using <form
id="<s:property..."?

This jsp is the same for 2 different namespaces, and I like the fact that I
can share it and struts automatically gives the correct namespace so the
correct profile page is shown...

Thanks,
Mike.



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Help with dynamic form id

Posted by Security Management <li...@secmgmt.com>.
Doh! I asked too soon, here it is:

<s:iterator value="people">
	<s:set name="form_id" value="[0].id"/>
	<s:form id='person_%{form_id}' name='person_%{form_id}'
action="personProfile">
		<s:hidden theme="checkbox-fix" key="id"/>
	</s:form>
</s:iterator>

Then, with JS, 

document.getElementById('person_<s:property value="id"/>').submit();


-----Original Message-----
From: Security Management [mailto:list-subscriptions@secmgmt.com] 
Sent: Monday, April 20, 2009 10:15 AM
To: 'Struts Users Mailing List'
Subject: Help with dynamic form id

I have the following in a jsp, I'm creating hidden forms to submit with
javascript when someone clicks on a table row:

<s:iterator value="people">
	<s:set name="form_id" value="[0].id"/>
	<s:form id="#form_id" action="personProfile">
		<s:hidden theme="checkbox-fix" key="id"/>
	</s:form>
</s:iterator>

I get the following HTML generated:

<form id="_form_id" name="personProfile"
action="/smc-appsuite/my-employees/personProfile" method="post">
<table class="wwFormTable">
	<tr style="display: none"><td colspan="2">
	<input type="hidden" name="id" value="3"
id="_form_id_id"/>/></td></tr>
</table></form>

Is there any way to do it other than not using s:form and using <form
id="<s:property..."?

This jsp is the same for 2 different namespaces, and I like the fact that I
can share it and struts automatically gives the correct namespace so the
correct profile page is shown...

Thanks,
Mike.



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org