See comments below:
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
> Behalf Of [EMAIL PROTECTED]
> Sent: Saturday, January 03, 2004 9:30 AM
> To: [EMAIL PROTECTED]
> Subject: RE: [displaytag-user] onclick attribute really needed
>
>
> Matt,
>
> What I wanna do is submit a Struts form while clicking on a
> link wrapped
> around the column's property.
>
> I cannot use a simple <a ..>...</a> tag nested into a
> <display:column> tag
> like you proposed.
Why not? You can always use an <a> tag to call a JavaScript function.
Here's the most common way:
<display:table name="contacts" id="contactList">
<display:column>
<a href="/path" onclick="document.forms[0].submit(); return
false"><c:out value="${contactList.name}"/></a>
</display:column>
</display:table>
HTH,
Matt
> This does not submit a form, and therefore
> all Struts form
> properties will be lost if I hardcore a link to a Struts
> actions with one
> request attribute such as the index of the column row.
>
> The only thing I can think of is to call a Javascript
> function that will
> submit the form. I see that you managed to call a Javascript
> function on the
> column header.
>
> Do you think there is a chance to call a Javascript function
> from the column
> data item (<display:column>) with on argument being the row
> index ? How ?
>
> Fred
>
>
> Matt wrote:
> -----------
>
> Do you want to change the hyperlink on the column heading or
> the one wrapped
> around the column's property?
>
> For the property, using the latest displaytag, you have access to the
> property, for example:
>
> <display:table name="contacts" id="contactList"> <display:column>
> <a href="/path"><c:out value="${contactList.name}"/></a>
> </display:column>
>
> This works splendidly, I tried it yesterday.
>
> If you want to alter the hyperlink at the top of the column,
> the only way I've
> found to do this was thing JavaScript. For instance, add the
> following at the
> bottom of your table:
>
> // get a tag of the 2nd column header and alter it to submit
> a form // with
> JavaScript table = document.getElementById("contactList");
> a = table.getElementsByTagName("th")[1].getElementsByTagName("a")[0];
> href = a.getAttribute("href");
> // replace the action in the href, and then set it as the
> action // on the
> form href = href.substring(href.indexOf(".do"));
> href = document.forms[0].action + href;
> a.onclick=function() {
> document.selectRows.action=href;document.selectRows.submit();
> return false };
>
> I was successfully able to get my form to submit when
> clicking on the column
> header, but I lost the ability to sort asc/desc on the table.
> I then realized
> that the requirements did not call for the ability to sort on
> this table and
> removed it altogether. ;0)
>
> Matt
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On
> > Behalf Of [EMAIL PROTECTED]
> > Sent: Saturday, January 03, 2004 8:51 AM
> > To: [EMAIL PROTECTED]
> > Subject: [displaytag-user] onclick attribute really needed
> >
> >
> > Hello,
> >
> > I really need to call java script functions on some columns items
> > hyperlinks.
> >
> > I have a huge Struts Form that needs to be submitted when the user
> > clicks on a column item. The resulting action forwards back to the
> > original JSP page.
> >
> > I cannot use a TableDecorator for printing something linke <a
> > href='...'>column_value</a> by a <display:column> tag,
> since I cannot
> > add to the request all the Struts Form properties (too many
> of them).
> >
> > I ** absolutely ** need to call a JavaScript function that
> will submit
> > my form. I do not see anyother solution. This function takes the
> > index of the
> > current row object and would look like :
> >
> > /*
> > * Update parameter master data
> > */
> > function showParameter(paramIndex)
> > {
> >
> > document.forms[0].reqCode.value='editParameter';
> > document.forms[0].reqParamIndex.value=paramIndex;
> > document.forms[0].submit();
> > return false;
> > }
> >
> > I need to call this JS function on a column data item.
> Anybody has a
> > clue how to do this with the display tag ?
> >
> > Besides I already posted a message about the need to have
> the onclick,
> > onblur, etc. event management attributes to be added to the
> > display:column tag. This
> > example shows that they MUST be added.
> >
> > I did not see any change request for this kind of stuff in release
> > 1.0-b3. Do you plan to include these attributes sometime
> soon ? Could
> > you please let me
> > know so I can decide whether or not I have to implement them
> > by myself as a
> > temporary solution.
> >
> > Best regards,
> >
> > Fred
> >
> >
> >
> > -------------------------------------------------------
> > This SF.net email is sponsored by: IBM Linux Tutorials. Become an
> > expert in LINUX or just sharpen your skills. Sign up for
> IBM's Free
> > Linux Tutorials. Learn everything from the bash shell to
> sys admin.
> > Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371> &op=click
> >
> > _______________________________________________
> >
> > displaytag-user mailing list [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/displaytag-user
> >
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: IBM Linux Tutorials.
> Become an expert in LINUX or just sharpen your skills. Sign
> up for IBM's Free
> Linux Tutorials. Learn everything from the bash shell to sys
> admin. Click
> now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
> _______________________________________________
> displaytag-user mailing list [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/displaytag-user
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: IBM Linux Tutorials.
> Become an expert in LINUX or just sharpen your skills. Sign
> up for IBM's Free Linux Tutorials. Learn everything from the
> bash shell to sys admin. Click now!
> http://ads.osdn.com/?ad_id=1278&alloc_id=3371> &op=click
>
> _______________________________________________
>
> displaytag-user mailing list [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/displaytag-user
>
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
displaytag-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-user