[ https://issues.apache.org/jira/browse/TAP5-194?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Igor Drobiazko reassigned TAP5-194: ----------------------------------- Assignee: Igor Drobiazko > Submit Button missing context and image support > ----------------------------------------------- > > Key: TAP5-194 > URL: https://issues.apache.org/jira/browse/TAP5-194 > Project: Tapestry 5 > Issue Type: Improvement > Affects Versions: 5.0.15 > Reporter: Cherry Development > Assignee: Igor Drobiazko > Attachments: SubmitContext.java > > > The Submit component has two major deficiencies: > 1) You cannot use an image submit ( <input type="image" /> ) > 2) You cannot pass any context into the button's "selected" event handler. > Issue 1 currently requires you to create your own submit button type, though > this is simple if you don't mind copy/pasting the current Submit class and > changing one line. > Issue 2 is a much bigger problem. If you have a submit button in a loop and > need to know (for example) which item was current in the loop when it was > rendered, you have to set "defer" to false, then record the context > information in your onSelected handler. You often can't perform a useful > action directly in your deferred onSelected handler because you shouldn't > change the structure of your bound data in the middle of a form submit, or > because you should not perform your action until you're assured the form has > validated. > So, you now have to record the context that you need to perform the action, > PLUS the action that needs to be performed, and then perform it all inside of > your onSuccess handler! Frankly, this seems so inelegant as to have been an > oversight. > On the Tapestry Wiki, at > http://wiki.apache.org/tapestry/Tapestry5SubmitContextComponent there is a > basic implementation, though it has several weaknesses: > 1) It was written for 5.0.4 and doesn't compile without changing a few minor > things, nor does it support RenderDisabled. > 2) It only supports a single context parameter and it makes no effort to > properly encode it when rendered to the client. > So, based on the concept used on the wiki code (namely, using a <hidden> > field to store the context) I made a few small modifications to the Tapestry > 5.0.11 Submit.java class that I will attach to this issue. > I grant ownership of the attached code to the Apache Software Foundation. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.