[ http://issues.apache.org/jira/browse/MYFACES-219?page=all ]
sean schofield updated MYFACES-219:
-----------------------------------
Fix Version: Nightly Build
Description:
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.
was:
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.
> 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
> Assignee: Thomas Spiegl
> Priority: Minor
> Fix For: Nightly Build
> 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