Hi, I am new to XForms and Orbeon XForms. I have one application where I need to show XForms controls in an IFRAME (since contents will be dynamic in nature) and other application related controls in rest of the page. I can save the data from XForms if I call the submission directly from my XForms using xforms:submit control. But, I want to use the submit functionality of my application with two operations 1) Save the data from XForms controls in an XML format (like the direct submission), and if it is successful, then , 2) I want to save the application related data. I do not want to make the complate page in XForms since I am using XForms for some limited functionality I am using Struts framework 1.3 and my pages are struts jsp pages. Pl. provide your valuable suggestions. Sabeer -- 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 |
Administrator
|
> I am new to XForms and Orbeon XForms. I have one application where I
So far so good.
> need to > show XForms controls in an IFRAME (since contents will be dynamic in > nature) > and other application related controls in rest of the page. I can > save the data > from XForms if I call the submission directly from my XForms using > xforms:submit control. But, I want to use the submit functionality > of my > application with two operations > 1) Save the data from XForms controls in an XML format (like the > direct > submission), and if it is successful, then , > 2) I want to save the application related data. I do not want to > make the > complate page in XForms since I am using XForms for some limited > functionality I am not sure I understand what this point means. Can you be more precise? -Erik -- Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.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 |
The idea is that my application user can upload .XHTML file( with XFORMS controls) and later they can enter information through the .XHTML file that they have uploaded. This form will be displayed in an IFRAME for data entry. This IFRAME is a part of my web page and there are other controls which are defined by my application in the same page. There is a submit button in my page and I want to use that submit button ( from struts jsp html:submit) to submit both the XFORMS data and data from other controls in the page to the server. In normal case, I can call any function (javascript) available in my iframe but in this case, I am not able to do that. my XHTML looks like <?xml version="1.0" encoding="iso-8859-1"?> <xhtml:html xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <xhtml:head> <xhtml:script> function saveform() { document.forms[0].submit(); } </xhtml:script> <xhtml:title/> <xforms:model> <xforms:instance id="medwatch" src="http://localhost:8080/orbeonintegration/XFormGetDataServlet"> </xforms:instance> <xforms:submission action="http://localhost:8080/orbeonintegration/XFormSaveDataServlet" ref="instance('medwatch')" method="post" id="save" replace="all" validate="false"/> </xforms:model> </xhtml:head> <xhtml:body> ---- controls and binding ---- <xforms:submit id="submit_0" submission="save"> <xforms:label>Submit</xforms:label> </xforms:submit> </xhtml:body> </xhtml:html> XFormGetDataServlet will return the instance data in the form of xml and XFormSaveDataServlet will write the xform data into a file. In my submit functionality of my page, I have called saveform() javascript function but nothing has happened. I hope, I am able to describe my problem -- 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 |
Administrator
|
> and I want to use that submit button ( from struts jsp html:submit)
> to submit > both the XFORMS data and data from other controls in the page to the > server. In > normal case, I can call any function (javascript) available in my > iframe but in > this case, I am not able to do that. You would then be mixing and matching an HTML form submission and an XForms submission. Ouch. When Orbeon Forms converts XForms to HTML, it automatically creates an HTML form. Your Struts tags will interfere with that. I am not saying it is strictly impossible to make it work, just that it sounds really messy. In addition, and XForms submission does not occur from the browser in Orbeon Forms, but from the server. So you really have two completely different types of submissions. I would advise you to try to keep things simple and only use an XForms submission. This said, what you could try is this: first do an XForms submission with replace="none". Then call JavaScript. This would look like this: <xforms:submission id="save" action="http://localhost:8080/orbeonintegration/XFormSaveDataServlet" ref="instance('medwatch')" method="post" replace="none" validate="false"/> <xforms:trigger> <xforms:label>Submit</xforms:label> <xforms:action ev:event="DOMActivate"> <xforms:send submission="save"/> <xxforms:script> saveform() </xxforms:script> </xforms:action> </xforms:trigger> This may get you somewhere, but the XForms data will be submitted first, and the HTML form data second. -Erik > my XHTML looks like > <?xml version="1.0" encoding="iso-8859-1"?> > <xhtml:html xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns:xforms="http://www.w3.org/2002/xforms" > xmlns:xhtml="http://www.w3.org/1999/xhtml" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > <xhtml:head> > <xhtml:script> > function saveform() { > document.forms[0].submit(); > } > </xhtml:script> > <xhtml:title/> > <xforms:model> > <xforms:instance id="medwatch" > src="http://localhost:8080/orbeonintegration/XFormGetDataServlet"> > > </xforms:instance> > <xforms:submission > action="http://localhost:8080/orbeonintegration/XFormSaveDataServlet" > ref="instance('medwatch')" method="post" > id="save" replace="all" validate="false"/> > </xforms:model> > </xhtml:head> > <xhtml:body> > > ---- controls and binding ---- > <xforms:submit id="submit_0" submission="save"> > <xforms:label>Submit</xforms:label> > </xforms:submit> > </xhtml:body> > </xhtml:html> > > XFormGetDataServlet will return the instance data in the form of xml > and > XFormSaveDataServlet will write the xform data into a file. In my > submit > functionality of my page, I have called saveform() javascript > function but > nothing has happened. I hope, I am able to describe my problem Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.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 |
Thanks for the suggestion.
Is there any way to prevent the XFORMS submission event ?. I would like to do the following approach. While pressing on Submit button on my XFORMS, before submitting the XFORMS data to the server, I wanted to check whether the mandatory fields outside of my XFORMS (on my main page) is available or not. If it is not there, then, I do not want to submit the XFORMS data. -- 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 |
Administrator
|
What you could do is the following:
* Use xforms:trigger to run a piece of script with xxforms:script * The script: ** checks your field in the HTML ** if necessary, fires a custom XForms event * The custom event triggers the submission if needed Some relevant doc: http://www.orbeon.com/ops/doc/reference-xforms-2#xforms-javascript -Erik On Feb 6, 2008, at 5:42 AM, Sabeer wrote: > Thanks for the suggestion. > Is there any way to prevent the XFORMS submission event ?. I would > like to do > the following approach. While pressing on Submit button on my > XFORMS, before > submitting the XFORMS data to the server, I wanted to check whether > the > mandatory fields outside of my XFORMS (on my main page) is available > or not. If > it is not there, then, I do not want to submit the XFORMS data. Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.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 |
Administrator
|
In reply to this post by Sabeer
Sabeer,
On Feb 6, 2008 5:42 AM, Sabeer <[hidden email]> wrote: > Thanks for the suggestion. > Is there any way to prevent the XFORMS submission event ?. I would like to do > the following approach. While pressing on Submit button on my XFORMS, before > submitting the XFORMS data to the server, I wanted to check whether the > mandatory fields outside of my XFORMS (on my main page) is available or not. If > it is not there, then, I do not want to submit the XFORMS data. If you have a button on the page which is intended to submit the form (i.e. xforms:trigger), you can have a complete control over the actions that run when the button is pressed. In particular, you can run some JavaScript with the xxforms:script that checks your other non-XForms form elements (see the first link below), sets the result back in an XForms instance (see second link below), and then you can run a conditional xforms:send (using the "if" attribute on xforms:send) based on that result. http://www.orbeon.com/ops/doc/reference-xforms-2#xxforms-script-extension http://www.orbeon.com/ops/doc/reference-xforms-2#xforms-javascript-get-set-value Alex -- Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ Personal Blog: http://avernet.blogspot.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 |
In reply to this post by Erik Bruchez
Thanks for your suggestion and I was able to find out the workarround for my problem. It is working perfect for IE but in Firefox 3.0.1, I am not able to get some of the events fired. Due to that my main JSP page ( Which has the iframe to show XFORM document) is not getting back response from XFORM I am using OPS 3.6 Here is my XFORM code <?xml version="1.0" encoding="UTF-8"?> <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xhtml:head> <xhtml:title/> <xforms:model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" id="medwatchmodelid" xxforms:external-events="do-something"> <xforms:instance id="medwatch" xmlns=""> <data> <patientinformation> <patientidentifier/> <ageatthetimeofevent/> <dateofbirth/> <sex> <female/> <male/> </sex> <weight> <lbs/> <kgs/> </weight> </patientinformation> </data> </xforms:instance> <xforms:submission action="http://localhost:8080/myapp/XFormSaveDataServlet?aerid=2165" encoding="iso-8859-1" id="save" method="post" mode="synchronous" ref="instance('medwatch')" replace="none" validate="false"/> <xforms:send submission="save" ev:event="do-something"/> <xforms:action ev:event="xforms-submit-done"> <xxforms:script> notifyparent(1); // submission of XFORM is successful </xxforms:script> </xforms:action> <xforms:action ev:event="xforms-submit-error" > <xxforms:script> notifyparent(0);// submission of XFORM is not successful </xxforms:script> </xforms:action > </xforms:model> </xhtml:head> <xhtml:body> <xforms:group appearance="full" ref="instance('medwatch')/patientinformation"> <xforms:label>A.PATIENT INFORMATION</xforms:label> <xhtml:h5>1.Patient Identifier</xhtml:h5> <xforms:input xmlns="" ref="patientidentifier" required="false()" style="width: 48px"> <xforms:label/> </xforms:input> <xhtml:h5>2.Age at the Time of Event:</xhtml:h5> <xforms:input xmlns="" ref="ageatthetimeofevent" style="width: 48px"> <xforms:label/> </xforms:input> <xhtml:h5>or Date of Birth:</xhtml:h5> <xforms:input xmlns="" ref="dateofbirth" style="width: 48px"> <xforms:label/> </xforms:input> </xforms:group> <xhtml:script type="text/javascript"> function saveform() { ORBEON.xforms.Document.dispatchEvent('medwatchmodelid','do-something'); } function notifyparent(value) { // Calls the function notify() from main page window.parent.notify(value); } </xhtml:script> </xhtml:body> </xhtml:html> Here is my JSP code from where I call submit operation In JSP //this is my submit button on main page. While submitting, it calls presubmit() function first. <button class="formButton" property="presubmit" onclick="javascript:presubmit();" function presubmit() { // Calls saveform()function from XFORM if(window.parent && window.parent.frames && window.parent.frames.iframe2 && window.parent.frames.iframe2.window )) window.parent.frames.iframe2.window.saveform(); else notify(0); } function notify(value) { if( value == 1) { saved = true; document.forms[0].submit(); } else { saved = false; } } Please suggest me what I have to do to work it for FireFox What I have achieved in IE using above code is I have an IFRAME on my main page where I show my XFORM through which data entry can be done. The main page has a submit button and while pressing on Submit button, the XFROM data got submitted initially and (This portion onwards is not working from FIREFOX ) if the XFORM submission is successful, it calls a function which is defined in the XFORM file itself and in that function it calls a java script function which is defined in main page. Then the main page calls its final form submission. Thanks Sabeer -- 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 |
Administrator
|
Orbeon Forms 3.6 has issues with Firefox 3.x, which have been fixed a
long time ago. However, that fix is only available in the nightly builds, and in the upcoming 3.7 beta 1 build. -Erik On Aug 24, 2008, at 11:28 PM, Sabeer wrote: > > Thanks for your suggestion and I was able to find out the > workarround for my > problem. It is working perfect for IE but in Firefox 3.0.1, I am not > able to > get some of the events fired. Due to that my main JSP page ( Which > has the > iframe to show XFORM document) is not getting back response from XFORM > I am using OPS 3.6 > > Here is my XFORM code > > <?xml version="1.0" encoding="UTF-8"?> > <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" > xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns:xforms="http://www.w3.org/2002/xforms" > xmlns:xsd="http://www.w3.org/2001/XMLSchema"> > <xhtml:head> > <xhtml:title/> > <xforms:model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" id="medwatchmodelid" > xxforms:external-events="do-something"> > > <xforms:instance id="medwatch" xmlns=""> > <data> > <patientinformation> > <patientidentifier/> > <ageatthetimeofevent/> > <dateofbirth/> > <sex> > <female/> > <male/> > </sex> > <weight> > <lbs/> > <kgs/> > </weight> > </patientinformation> > </data> > > </xforms:instance> > > > <xforms:submission > action="http://localhost:8080/myapp/XFormSaveDataServlet?aerid=2165" > encoding="iso-8859-1" id="save" method="post" mode="synchronous" > ref="instance('medwatch')" replace="none" validate="false"/> > > > <xforms:send submission="save" ev:event="do-something"/> > > <xforms:action ev:event="xforms-submit-done"> > <xxforms:script> > notifyparent(1); // submission of XFORM > is successful > </xxforms:script> > </xforms:action> > > <xforms:action ev:event="xforms-submit-error" > > <xxforms:script> > notifyparent(0);// submission of XFORM > is not successful > </xxforms:script> > </xforms:action > > > </xforms:model> > </xhtml:head> > <xhtml:body> > > <xforms:group appearance="full" > ref="instance('medwatch')/patientinformation"> > <xforms:label>A.PATIENT INFORMATION</xforms:label> > <xhtml:h5>1.Patient Identifier</xhtml:h5> > <xforms:input xmlns="" ref="patientidentifier" > required="false()" style="width: 48px"> > <xforms:label/> > </xforms:input> > <xhtml:h5>2.Age at the Time of Event:</xhtml:h5> > <xforms:input xmlns="" > ref="ageatthetimeofevent" style="width: 48px"> > <xforms:label/> > </xforms:input> > <xhtml:h5>or Date of Birth:</xhtml:h5> > <xforms:input xmlns="" ref="dateofbirth" > style="width: 48px"> > <xforms:label/> > </xforms:input> > </xforms:group> > > > > <xhtml:script type="text/javascript"> > function saveform() > { > > ORBEON.xforms.Document.dispatchEvent('medwatchmodelid','do- > something'); > } > > > > function notifyparent(value) > { > // Calls the function notify() from main page > window.parent.notify(value); > } > > </xhtml:script> > > > </xhtml:body> > </xhtml:html> > > > Here is my JSP code from where I call submit operation > In JSP > > //this is my submit button on main page. While submitting, it calls > presubmit() > function first. > > <button class="formButton" property="presubmit" > onclick="javascript:presubmit();" > > > > function presubmit() > { > // Calls saveform()function from XFORM > if(window.parent && window.parent.frames && > window.parent.frames.iframe2 && window.parent.frames.iframe2.window )) > window.parent.frames.iframe2.window.saveform(); > else > notify(0); > } > > function notify(value) > { > if( value == 1) > { > saved = true; > document.forms[0].submit(); > } > else > { > saved = false; > > } > > } > > Please suggest me what I have to do to work it for FireFox > > What I have achieved in IE using above code is > I have an IFRAME on my main page where I show my XFORM through which > data entry > can be done. The main page has a submit button and while pressing on > Submit > button, the XFROM data got submitted initially and (This portion > onwards is not > working from FIREFOX ) > if the XFORM submission is successful, it calls a function which is > defined in > the XFORM file itself and in that function it calls a java script > function > which is defined in main page. Then the main page calls its final form > submission. > > Thanks > Sabeer > > -- > 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 Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.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 |
Free forum by Nabble | Edit this page |