Re: [Xsltforms-support] Models and best practice for submission confirmation
Brought to you by:
alain-couthures
From: William V. <wve...@vi...> - 2013-05-10 15:19:44
|
XForms 2.0 defines variables in actions that you can use in the submission attribute of the xf:send action or any other attribute of actions, but I think it is not implemented in XSLTForms yet. Another posibility could be AVTs, but XSLTForms only support them for HTML content. Maybe somebody else in the list has another idea that can be used with XSLTForms. William David Velásquez Director de I+D Visión Tecnológica S.A.S. Tel: (4) 444 7292 Cel: 313 743 54 11 wve...@vi... ________________________________________ De: peter winstanley [p....@in...] Enviado: jueves, 09 de mayo de 2013 05:09 p.m. Para: William Velasquez; xsl...@li... Asunto: Re: [Xsltforms-support] Models and best practice for submission confirmation Hi William This is really useful stuff, but perhaps I didn't define my question well enough. I was wondering if it is possible to set up this 'confirmation' methodology to take a variable that is the name/id of the submission (or any other action that requires confirmation), so that I could use the same "yes/no" dialogue to cover 'dopost', 'dosomeotherpost', 'doadelete', or any other type of submission etc Cheers Peter > -----Original Message----- > From: wve...@vi... > Sent: Thu, 9 May 2013 20:22:18 +0000 > To: p....@in..., xsl...@li... > Subject: Re: [Xsltforms-support] Models and best practice for submission > confirmation > > You can use a JavaScript function and call it from the xf:if attribute of > the action. > > Put this script inside the <head> of your page: > > <script type="text/javascript"><![CDATA[ > var shouldsave = function(msg){ > return confirm(msg) ? "true" : "false"; > }; > ]]></script> > > > And use an xf:trigger with the xf:send action for the submission, with > the if attribute: > > <xf:trigger> > <xf:label>Save</xf:label> > <xf:action ev:event="DOMActivate" if="shouldsave('Are you sure?') = > true()" > > <xf:send submission="dopost"/> > </xf:action> > </xf:trigger> > > > > * Note that calling JavaScript from XPath expressions only works after > XSLTForms 1.0 > > William David Velásquez > Director de I+D > Visión Tecnológica S.A.S. > Tel: (4) 444 7292 > Cel: 313 743 54 11 > wve...@vi... > ________________________________________ > De: peter winstanley [p....@in...] > Enviado: miércoles, 08 de mayo de 2013 05:46 p.m. > Para: William Velasquez; xsl...@li... > Asunto: Re: [Xsltforms-support] Models and best practice for submission > confirmation > > Hi William, > > Thanks ... that is about the simplest pattern I have seen. > > Would it be possible to turn the "confirm" dialog into a sort of function > e.g. taking the identity of submission from a value in an instance node, > perhaps? > > Cheers > > Peter > >> -----Original Message----- >> From: wve...@vi... >> Sent: Wed, 8 May 2013 21:09:56 +0000 >> To: p....@in..., xsl...@li... >> Subject: Re: [Xsltforms-support] Models and best practice for submission >> confirmation >> >> You can do it using a xf:dialog with a xf:submit labeled "Yes" and a >> xf:trigger labeled "No" that closes the dialog. >> >> Below is the code: >> >> >> <xf:trigger> >> <xf:label>Save</xf:label> >> <xf:action ev:event="DOMActivate"> >> <xf:show dialog="confirm"/> >> </xf:action> >> </xf:trigger> >> >> <xf:dialog id="confirm"> >> <span>Are you sure?</span> >> <xf:submit submission="dopost"> >> <xf:label>Yes</xf:label> >> </xf:submit> >> <xf:trigger> >> <xf:label>No</xf:label> >> <xf:action ev:event="DOMActivate"> >> <xf:hide dialog="confirm"/> >> </xf:action> >> </xf:trigger> >> </xf:dialog> >> >> William David Velásquez >> Director de I+D >> Visión Tecnológica S.A.S. >> Tel: (4) 444 7292 >> Cel: 313 743 54 11 >> wve...@vi... >> ________________________________________ >> De: peter winstanley [p....@in...] >> Enviado: miércoles, 08 de mayo de 2013 11:53 a.m. >> Para: XSLTForms support >> Asunto: [Xsltforms-support] Models and best practice for submission >> confirmation >> >> Hello List >> >> Are there any good examples illustrating the best way to implement a >> confirmation dialogue for a submission event (asking the user if they >> want to continue, and reverting to the form if they don't)? >> >> Many thanks >> >> Peter >> >> ____________________________________________________________ >> FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on >> your desktop! >> Check it out at http://www.inbox.com/marineaquarium >> >> >> >> ------------------------------------------------------------------------------ >> Learn Graph Databases - Download FREE O'Reilly Book >> "Graph Databases" is the definitive new guide to graph databases and >> their applications. This 200-page book is written by three acclaimed >> leaders in the field. The early access version is available now. >> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may >> _______________________________________________ >> Xsltforms-support mailing list >> Xsl...@li... >> https://lists.sourceforge.net/lists/listinfo/xsltforms-support > > ____________________________________________________________ > GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at > http://www.inbox.com/smileys > Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ > and most webmails ____________________________________________________________ FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop! Check it out at http://www.inbox.com/earth |