One concern I see with this. Shouldn't the component try and dynamically find a UIForm component parent and use that instead of the user having to specify what form to use? I believe that is how things like HtmlCommandLink works when they are not inside a form (the render the dummy form if they can't find a parent).
-----Original Message----- From: Jason Kissinger (JIRA) [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 17, 2005 6:05 PM To: dev@myfaces.apache.org Subject: [jira] Updated: (MYFACES-219) JSCookMenu as child of a form [ http://issues.apache.org/jira/browse/MYFACES-219?page=all ] Jason Kissinger updated MYFACES-219: ------------------------------------ Attachment: jscook.patch Patch which adds formId attribute to x:jscookMenu of an optional form which contains this menu. Defaults to using the dummy form as before. I modified generated code since I didn't have time to figure out the code generation feature. Thanks to Tobias for the code. > JSCookMenu as child of a form > ------------------------------ > > Key: MYFACES-219 > URL: http://issues.apache.org/jira/browse/MYFACES-219 > Project: MyFaces > Type: New Feature > Versions: 1.0.9 beta > Environment: Windows XP, Tomcat 5.0.28 > Reporter: Tobias Neubert > Priority: Minor > Attachments: jscook.patch > > The HtmlCommandJSCookMenu component renders its own html-form called > linkDummyForm. If it is embedded into another form the other form (including > its children) will never be decoded because its submitted-property is set to > false in UIForm.decode(). > It should be possible to control wether the HtmlCommandJSCookMenu component > should render its own form or should be part of an existing form. > In my application I developed a solution for this problem. > 1. The HtmlJSCookMenuTag needs a new property, which holds the id of the form > which is the parent of this tag. I called it formId. This new property has to > be added in HtmlJSCookMenuTag.setProperties(). > 2. The HtmlCommandJSCookMenu component needs the formId property, > described in step 1, aswell. And it has to be added to saveState() and > restoreState() 3. The HtmlJSCookMenuRenderer has to read the formId of its > component. > 3.1 If it is not set everything stays as it is in the moment. That means: > DummyFormResponseWriter.writeDummyForm is set to true, which causes the > writer to append a linkDummyForm at the end of the rendered html page. > 3.2 If it is set writeDummyForm of DummyFormResponseWriter is set to false. > Instead of rendering a form (called linkDummyForm) at the end of the rendered > html page, there are only two input-fields, which will be rendered within > HtmlJSCookMenuRenderer.encodeChildren(): jscook_action, which holds the > choosed actionstring from the menu (in the moment it is rendered as part of > the linkDummyForm only) and a new field named jscook_form_id which gets the > formId of the HtmlCommandJSCookMenu component. > 4. The cmItemMouseUp function within the JavaScript library named > JSCookMenu.js needs to read the jscook_form_id field, rendered previously in > step 3.2 like this: > -------begin code-------------------------------------------- > var formId = null; > var dummyForm = null; > var inputFormIds = document.getElementsByName('jscook_form_id'); > if (inputFormIds.length > 0) { > formId = inputFormIds[0].value; > dummyForm = document.forms[formId]; > } else { > dummyForm = document.forms['linkDummyForm']; } > > dummyForm.elements['jscook_action'].value = link; dummyForm.submit(); > ------------end code------------------------- 5. Moreover it is needed > to configure the immediate attribute of the component in the > HtmlJSCookMenuTag. In the moment it is hardcoded in HtmlCommandJSCookMenu. > There exists another issue here in the database concerning this point. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira