- From: Ulrich Nicolas Lissé <unlisse@googlemail.com>
- Date: Fri, 9 Mar 2007 15:04:05 +0100
- To: adam.flinton@nhs.net
- Cc: "Www-Forms Www-Forms" <www-forms@w3.org>
Adam, the ev:event="xforms-submit-done" declaration is pointless, since xforms-submit-done is dispatched to xf:submission. So the inner action will be activated after xf:send anyway. Regards, Uli. On 3/7/07, Adam Flinton <adam.flinton@nhs.net> wrote: > > Dear All, > > I have an XForm (either native (e.g. in firefox) or rendered to html by > Chiba within a larger page made up by & controlled by JSF. > > So quick tip time: > > On the XForm submit trigger/action , add a sub-action which uses post > submit-done to call a javascript method called > clickLinkByClass('Refresh','input') e.g. > > <xforms:trigger id="OID_Group_trigger" style="display:block"> > <xforms:label>Update</xforms:label> > <xforms:action ev:event="DOMActivate"> > <xforms:send submission="xmlprocess" /> > <xforms:action ev:event="xforms-submit-done" propagate="false"> > <xforms:load > > resource="javascript:clickLinkByClass('Refresh','input')" /> > </xforms:action> > </xforms:action> > </xforms:trigger> > > > > The JS is: > > function clickLinkByClass(Classname,tagname){ > > var targetE1; > myObjCol = getElementsByClassName(Classname, tagname); > if (myObjCol != null && myObjCol.length > 0){ > for (i = 0, j = myObjCol.length; i < j; i++) { > targetE1 = myObjCol[i]; > } > //var targetID1 = targetE1.id; > if (document.createEvent) > { > var evObj = document.createEvent('MouseEvents') > evObj.initEvent( 'click', true, false ) > targetE1.dispatchEvent(evObj) > } > else if (document.createEventObject) > { > targetE1.fireEvent('onclick') > } > } > } > > > Then on your main jsf (i.e. the one which includes the XForm) place a > button action which simply calls an empty method on the Backing bean e.g. > > <h:form id="RefreshForm" rendered="true"> > > <h:inputHidden id="XMLFile" value="#{DisplayController.xmlFile}" /> > <h:inputHidden id="editState" > value="#{DisplayController.editState}" /> > <h:inputHidden id="type" value="xform" /> > <h:inputHidden id="JavaScriptYN" value="" /> > > <h:panelGrid columns="1"> > > <h:commandButton id="Refresh" value="Refresh" > action="#{DOMElement.refresh}" styleClass="Refresh"> > <t:updateActionListener property="#{DOMElement.init}" > value="#{DisplayController.xmlFile}" /> > <t:updateActionListener property="#{DOMElement.nodeLocator}" > value="#{DOMElement.nodeLocator}" /> > </h:commandButton> > </h:panelGrid> > > </h:form> > > > Then hide it from view via css e.g. > > input.Refresh{display:none; visibility: hidden;} > > et voila when the XForm submits, the JSF is refreshed. > > Adam > > ********************************************************************** > Information in this message may contain confidential and privileged > information. If you are not the intended recipient please accept our > apologies; please do not disclose, copy or distribute information in > this e-mail or take any action in reliance on its contents: to do so > is strictly prohibited and may be unlawful. Please inform us that this > message has gone astray before deleting it. Thank you for your > co-operation. > > NHSmail is used daily by over 100,000 staff in the NHS. Over a million > messages are sent every day by the system. To find out why more and > more NHS personnel are switching to this NHS Connecting for Health > system please visit www.connectingforhealth.nhs.uk/nhsmail > ********************************************************************** > > > >
Received on Friday, 9 March 2007 14:04:15 UTC