You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Greg Preston <gr...@intervoice.com> on 2003/07/10 00:20:17 UTC

Getting actional field name from :

All,

I'm using the nested:iterate tag to display field information.  I need to pass the actual name of the field to a Javascript function.  I thought I needed to define a few attributes using the <nested:define> tag and then render those as parameters in my javascript function call.

So my code looks like this:

<nested:define id="field_name" property="short_name" type="java.lang.String"/>
<nested:define id="source_id" property="source_id" type="java.lang.Integer"/>

<nested:text property="short_name" />
<input type="button" value="browse" onclick="openWindow( '<%= field_name %>',<%= ( (Integer)source_id ).intValue() %> )">
                                             

My output looks like this (which after RTFM is what I would expect):

<input type="text" name="meta_data[0].short_name" value="Customer Number">
<input type="button" value="browse" onclick="openWindow( 'Customer Number',8 )">


My desired output would be:

<input type="text" name="meta_data[0].short_name" value="Customer Number">
<input type="button" value="browse" onclick="openWindow( 'meta_data[0].short_name',8 )">


Again, how do I get the nested field name?

Thanks in advance

Greg