Re: [xwiki-users] possible bug - inline editor evaluates form hidden variables on save
----- "Marius Dumitru Florea" <[email protected]> wrote:
On Thu, Sep 29, 2011 at 9:19 PM, Scott Serr <[email protected]> wrote:
I ran into an interesting side effect of having a form in my Class
Sheet.
<input type="hidden" name="parent" value="${doc.fullName}" />
The above line is in a form which posts to the current page, but
then redirects to a sub-page. The process is exactly like the FAQ Example. The trouble is, when doing Inline Editing on a page with the class object. No matter what you put in as the parent in the UI for the parent property, it gets reset to itself on save. The wiki and WYSYWIG editors don't do this of course.
I think this is a problem because...
1. Should this form (and form element) really be evaluated? No one hit the submit button.
How did you save without hitting the submit button? (You said "it gets reset to itself on save").
2. It doesn't seem very safe for variable spaces to mix so easily. Unless this is a feature.
"Inline form" edit mode is used to edit object properties. If you use $doc.display method to generate your form fields then you'll see that the field IDs/names look like this: ClassName_objectIndex_propertyName , so they don't interfere with the rest of the (hidden) fields like "parent" which is used to set the document title. If you generate the form fields yourself then indeed you have to take care to use unique IDs/names to prevent conflicts.
Hope this helps, Marius
Thanks for the reply. My page has a form like {{{html}}}<form></form>{{{/html}}} if you look at the wiki code. I'll call this the "embedded form." So when the page is viewed, then the embedded form is available. An aside, the embedded form creates sub-pages. The page also has an object and I'm fine with editing those properties in the inline form editor. And, of course the embedded form on my page is not displayed because the inline editor only shows and edits the object. My trouble comes here, when I save that object in the inline editor, I get the embedded form's hidden post variables evaluated. I did not click my embedded form's submit, I clicked the inline editor's save. It behaves as if I clicked the embedded form's submit just before the inline editor's save. I know it sounds crazy. I'll try to isolate it to a minimal test case.
On Mon, Oct 3, 2011 at 11:25 PM, Scott Serr <[email protected]> wrote:
----- "Marius Dumitru Florea" <[email protected]> wrote:
On Thu, Sep 29, 2011 at 9:19 PM, Scott Serr <[email protected]> wrote:
I ran into an interesting side effect of having a form in my Class
Sheet.
<input type="hidden" name="parent" value="${doc.fullName}" />
The above line is in a form which posts to the current page, but
then redirects to a sub-page. The process is exactly like the FAQ Example. The trouble is, when doing Inline Editing on a page with the class object. No matter what you put in as the parent in the UI for the parent property, it gets reset to itself on save. The wiki and WYSYWIG editors don't do this of course.
I think this is a problem because...
1. Should this form (and form element) really be evaluated? No one hit the submit button.
How did you save without hitting the submit button? (You said "it gets reset to itself on save").
2. It doesn't seem very safe for variable spaces to mix so easily. Unless this is a feature.
"Inline form" edit mode is used to edit object properties. If you use $doc.display method to generate your form fields then you'll see that the field IDs/names look like this: ClassName_objectIndex_propertyName , so they don't interfere with the rest of the (hidden) fields like "parent" which is used to set the document title. If you generate the form fields yourself then indeed you have to take care to use unique IDs/names to prevent conflicts.
Hope this helps, Marius
Thanks for the reply.
My page has a form like {{{html}}}<form></form>{{{/html}}} if you look at the wiki code. I'll call this the "embedded form." So when the page is viewed, then the embedded form is available. An aside, the embedded form creates sub-pages. The page also has an object and I'm fine with editing those properties in the inline form editor. And, of course the embedded form on my page is not displayed because the inline editor only shows and edits the object. My trouble comes here, when I save that object in the inline editor, I get the embedded form's hidden post variables evaluated. I did not click my embedded form's submit, I clicked the inline editor's save. It behaves as if I clicked the embedded form's submit just before the inline editor's save.
I know it sounds crazy. I'll try to isolate it to a minimal test case.
In this particular case, the content of your page (containing the HTML macro with the "embedded" form) is evaluated both when viewing the page and when editing it in "Inline form" edit mode. If you look at the HTML source of your page when in "Inline form" edit mode (right click + "View Page Source" from context menu in Firefox) you'll see that your form is nested inside the "inline" form. This is not HTML valid and the browser removes the inner form but keeps its contents. You get the "inline" form with the fields of your "embedded" form as a result. Maybe you should check $context.action and generate the "embedded" form only when in view mode. Hope this helps, Marius
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
participants (2)
-
Marius Dumitru Florea -
Scott Serr