I have created a dialog where I wish to edit an input-field and a textarea-field nested within a repeat. For this purpose I created an id element which would serve as an identifier. However, this would require a counter of some kind to generate a unique id for every repeat, which I was unable to accomplish.
Instead, I tried setting the identifier to an element edited by the user. However, setting the identifier for the input element to the textarea element and the other way around will cause some confusion, obviously, and will not allow me to edit both fields at the same time. Is there an easy way of solving this? /Jimmy http://wiki.orbeon.com/forms/how-to/view/edit-details-in-dialog |
Administrator
|
Do you have concrete code? I don't picture the issue.
-Erik On Fri, Jun 1, 2012 at 8:51 AM, Jimmy <[hidden email]> wrote: > I have created a dialog where I wish to edit an input-field and a > textarea-field nested within a repeat. For this purpose I created an id > element which would serve as an identifier. However, this would require a > counter of some kind to generate a unique id for every repeat, which I was > unable to accomplish. > > Instead, I tried setting the identifier to an element edited by the user. > However, setting the identifier for the input element to the textarea > element and the other way around will cause some confusion, obviously, and > will not allow me to edit both fields at the same time. > > Is there an easy way of solving this? > > /Jimmy > > http://wiki.orbeon.com/forms/how-to/view/edit-details-in-dialog > > -- > View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/edit-details-in-dialog-problem-with-identifier-tp4655174.html > Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com. > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Hello Erik!
Let's say I have an instance that looks something like the one below. I have an additional instance for my FAQ entry repeat and a dialog ui instance. I've added an id element as an identifier for the dialog window which will allow me to edit a single FAQ entry without any hiccups. With another one set in the repeat-instance (with a different value), I am also able to edit the first faq entry created in my main instance with the repeat. Other than that I'd need to implement a counter of some sort which I wasn't able to. Instead I tried setting the identifier in the trigger/dialog to an element which could be edited by the user. However, I did not want to create another input control for the single purpose of acting as an identifier. With this in mind, I cant quite figure out how to edit both the answer and the question in one go. My instance: <xforms:instance id="main-instance"> <faq> <faq-entry> <id>1</id> <question>Lorem ipsum dolor sit amet</question> <answer>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris cursus dui in quam molestie placerat.</answer> </faq-entry> </faq> </xforms:instance> ..and this is my edit trigger for the dialog window: <xforms:trigger appearance="minimal"> <xforms:label> <span class="edit-controls-trigger">Edit</span> </xforms:label> <xforms:action ev:event="DOMActivate"> <xxforms:variable name="current-field" select="."/> <xforms:insert context="instance('ui')/edited-field" origin="instance('main-instance')/faq-entry[id = $current-field/id]"/> <xxforms:show dialog="edit-faq-entry-dialog"/> </xforms:action> </xforms:trigger> .. and, finaly, the dialog window itself: <xxforms:dialog id="edit-faq-entry-dialog"> <xforms:label>Edit FAQ</xforms:label> <xforms:delete ev:event="xxforms-dialog-close" nodeset="instance('ui')/edited-field/faq-entry"/> <xforms:group ref="instance('ui')/edited-field/faq-entry" id="edit-faq-entry-group"> <xforms:input nodeset="question"/> <xforms:textarea nodeset="answer"/> <xforms:trigger> <xforms:label>Cancel</xforms:label> <xxforms:hide ev:event="DOMActivate" dialog="edit-faq-entry-dialog"/> </xforms:trigger> <xforms:trigger> <xforms:label>OK</xforms:label> <xforms:action ev:event="DOMActivate"> <xforms:dispatch name="fr-visit-all" targetid="faq-entry-error-summary"/> <xforms:refresh/> <xforms:dispatch name="fr-update" targetid="faq-entry-error-summary"/> <xforms:action if="instance('ui')/valid = 'true'"> <xforms:setvalue ref="instance('main-instance')/faq-entry[id = context()/id]/question" value="context()/question"/> <xforms:setvalue ref="instance('main-instance')/faq-entry[id = context()/id]/answer" value="context()/answer"/> <xxforms:hide ev:event="DOMActivate" dialog="edit-faq-entry-dialog"/> </xforms:action> </xforms:action> </xforms:trigger> </xforms:group> </xxforms:dialog> |
Administrator
|
So is the issue that you can't write things back?
Can you provide as standalone example and point to where things are not working? Thanks, -Erik On Wed, Jun 6, 2012 at 5:46 AM, Jimmy <[hidden email]> wrote: > Hello Erik! > > Let's say I have an instance that looks something like the one below. I have > an additional instance for my FAQ entry repeat and a dialog ui instance. > I've added an id element as an identifier for the dialog window which will > allow me to edit a single FAQ entry without any hiccups. With another one > set in the repeat-instance (with a different value), I am also able to edit > the first faq entry created in my main instance with the repeat. > Other than that I'd need to implement a counter of some sort which I wasn't > able to. > > Instead I tried setting the identifier in the trigger/dialog to an element > which could be edited by the user. However, I did not want to create another > input control for the single purpose of acting as an identifier. > With this in mind, I cant quite figure out how to edit both the answer and > the question in one go. > > My instance: > > > ..and this is my edit trigger for the dialog window: > > > .. and, finaly, the dialog window itself: > > > > > -- > View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/edit-details-in-dialog-problem-with-identifier-tp4655174p4655214.html > Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com. > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Precisely.
If we take the wiki example and just edit the name output control to an input and add another xforms:setvalue in the xforms:action of the dialog like so: <xxforms:dialog id="edit-planet-dialog"> <xforms:label>Edit Planet</xforms:label> <xforms:delete ev:event="xxforms-dialog-close" nodeset="instance('ui')/edited-planet/planet"/> <xforms:group ref="instance('ui')/edited-planet/planet" id="edit-planet-group"> <!-- planet name output changed to input --> <xforms:input value="name"> <xforms:label>Planet</xforms:label> </xforms:input> <xforms:textarea ref="description" class="edit-planet-textarea"> <xforms:label>Description</xforms:label> <xforms:alert>Required field</xforms:alert> </xforms:textarea> <xhtml:div class="buttons"> <xforms:trigger> <xforms:label>Cancel</xforms:label> <xxforms:hide ev:event="DOMActivate" dialog="edit-planet-dialog"/> </xforms:trigger> <xforms:trigger> <xforms:label>OK</xforms:label> <xforms:action ev:event="DOMActivate"> <xforms:dispatch name="fr-visit-all" targetid="planet-error-summary"/> <xforms:refresh/> <xforms:dispatch name="fr-update" targetid="planet-error-summary"/> <xforms:action if="instance('ui')/valid = 'true'"> <xforms:setvalue ref="instance('planets')/planet[name = context()/name]/description" value="context()/description"/> <!-- additional setvalue for name element where context is set to description --> <xforms:setvalue ref="instance('planets')/planet[description = context()/description]/name" value="context()/description"/> <xxforms:hide ev:event="DOMActivate" dialog="edit-planet-dialog"/> </xforms:action> </xforms:action> </xforms:trigger> </xhtml:div> </xforms:group> <fr:error-summary id="planet-error-summary" observer="edit-planet-group" valid-ref="instance('ui')/valid" incremental="false"> <fr:label>This dialog contains an error:</fr:label> </fr:error-summary> </xxforms:dialog> What should I alter the context to? How do I xpath myself out of that mess? |
Administrator
|
Jimmy,
I don't know but if I can't run a standalone example quickly I am less likely to manage to look at the issue. -Erik On Tue, Jun 12, 2012 at 7:14 AM, Jimmy <[hidden email]> wrote: > Precisely. > > If we take the wiki example and just edit the name output control to an > input and add another xforms:setvalue in the xforms:action of the dialog > like so: > > > > What should I alter the context to? How do I xpath myself out of that mess? > > -- > View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/edit-details-in-dialog-problem-with-identifier-tp4655174p4655245.html > Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com. > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |