Multiple forms at the same page

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple forms at the same page

Björn Molin
Hi

I load a form in edit mode into a div tag after the page is loaded. Further, I would like to load some other forms in view mode in other div tags. At first, it seems to work fine but the save and submit button in the edit form does not work after the view form is loaded.

I think the problem is that the forms interfere in the ORBEON DOM node and the AJAX calls to xforms-server get into trouble.

I have a minimal sample below.

I am looking for a work-around. Can the forms including data in view mode be loaded in plain html without script dependencies? I had a look at the no-script mode, but I like to have with script in edit mode.

Any help would be greatly appreciated
/Björn

<html>
<head>
  <script language="javascript" type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
</head>

<body>

  <script type="text/javascript" charset="utf-8">
     $(document).ready(function () {

      $("#xform-in-edit-mode").load("/orbeon/fr/Demo/Hello/edit/19d4ac9e596a490541aa7526c03a5e64255e2df0?orbeon-embeddable=true", function(data) {
        if (typeof ORBEON != "undefined") { 
          if (!document.all) {
            ORBEON.xforms.Init.document(); 
          } 
        } 
      }); 

     $("#second-xform-in-view-mode").load("/orbeon/fr/Demo/Hello/view/eb735297a05fc4f7437957105e05db5f79eb1a57?orbeon-embeddable=true", function(data) {
      if (typeof ORBEON != "undefined") { 
          if (!document.all) {
            ORBEON.xforms.Init.document(); 
          } 
        } 
      }); 
     
  });
  </script>

  A form in edit mode
  <div id="xform-in-edit-mode">Loading a form in edit mode...please wait...</div>

  A second form in view mode
  <div id="second-xform-in-view-mode">Loading second form in view mode...please wait...</div>


</body>
</html>
Reply | Threaded
Open this post in threaded view
|

Re: Multiple forms at the same page

Björn Molin
Nabble did not send the sample code to the mailing list.
View it at
http://orbeon-forms-ops-users.24843.n4.nabble.com/Multiple-forms-at-the-same-page-tp4656436.html

I try to post it again below:

<html>
<head>
   <script language="javascript" type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
</head>

<body>

   <script type="text/javascript" charset="utf-8">
      $(document).ready(function () {

       $("#xform-in-edit-mode").load("/orbeon/fr/Demo/Hello/edit/19d4ac9e596a490541aa7526c03a5e64255e2df0?orbeon-embeddable=true", function(data) {
         if (typeof ORBEON != "undefined") {
           if (!document.all) {
             ORBEON.xforms.Init.document();
           }
         }
       });

      $("#second-xform-in-view-mode").load("/orbeon/fr/Demo/Hello/view/eb735297a05fc4f7437957105e05db5f79eb1a57?orbeon-embeddable=true", function(data) {
       if (typeof ORBEON != "undefined") {
           if (!document.all) {
             ORBEON.xforms.Init.document();
           }
         }
       });
     
   });
   </script>

   A form in edit mode
   <div id="xform-in-edit-mode">Loading a form in edit mode...please wait...</div>

   A second form in view mode
   <div id="second-xform-in-view-mode">Loading second form in view mode...please wait...</div>


</body>
</html>




--
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
Reply | Threaded
Open this post in threaded view
|

RE: Multiple forms at the same page

Stian Sigvartsen
In reply to this post by Björn Molin
Hi Björn

I've experienced this issue when rendering multiple forms on the same portal page. i.e. a form per portlet using separate portlet deployment method.
It looks like when the page initialises, Orbeon sends one HTTP request for each portlet (resource phase requests) which is expected, but every request specifies the same resource meaning portlet 2 is referencing the orbeon session for portlet 1 etc.  This only appears to happen during Orbeon forms page initialisation stage and the noticeable effect is that the *first* interaction with forms besides from the first form to appear in the HTML source, is ignored. In my case, I have buttons that unless you click somewhere else on the form first (focus event), button activation is ignored.

As a workaround I have had some success by iFraming each Orbeon form using the "share on any website" feature that Liferay Portal provides for any portlet. Hopefully this or similar iFrame approach will work for you too?

-Stian


--
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
Reply | Threaded
Open this post in threaded view
|

RE: Multiple forms at the same page

Björn Molin
Hi Stian

Yes, iframes would work but I prefer to load the forms in div tags (if possibly). The ajax load of forms into div tags is a very nice way to integrate orbeon forms.

Your description of the problem is even my experience, but I have no portlets. The little special in my case is that I only show one form in edit mode, the other forms are in view mode. I think that it would be good to be able to render a "no AJAX" view of a previously submitted/saved form.

Of course, it would be nice to even be able to render two editable forms at the same page as well. It is obviously out of the scope of current implementation.

Thank you for feed-back
Björn
Reply | Threaded
Open this post in threaded view
|

RE: RE: Multiple forms at the same page

Stian Sigvartsen
In reply to this post by Björn Molin
HI Björn

Your approach is actually similar to my current approach (without iFrames). I'm rendering multiple portlets each showing an Orbeon form in "view mode". If you want to edit data using these forms then you press an "edit" button on the form (the only control that's not disabled) which then takes you to a full page rendition of that particular form in "edit mode". This is easy to achieve with portlets because you can tell the portlet to go to "maximised" view mode and the rest is handled by the portal container. Unlike the approach you described (with which you're experiencing issue) I never render a mix of form in edit and view mode on the same page, though this is something I would really like to achieve too. The bug I described doesn't appear to come into effect so much if all forms render in the view mode and simply render an enabled button to go to full page edit mode for that particular form.

p.s. I intend to learn about the ajax load of forms into div tags you describe. This could remove the need of a full page submit which is affecting user experience. Sounds good.

-Stian

-----Original Message-----
From: bjorn [mailto:[hidden email]]
Sent: 20 March 2013 12:00
To: [hidden email]
Subject: [ops-users] RE: Multiple forms at the same page

Hi Stian

Yes, iframes would work but I prefer to load the forms in div tags (if possibly). The ajax load of forms into div tags is a very nice way to integrate orbeon forms.

Your description of the problem is even my experience, but I have no portlets. The little special in my case is that I only show one form in edit mode, the other forms are in view mode. I think that it would be good to be able to render a "no AJAX" view of a previously submitted/saved form.

Of course, it would be nice to even be able to render two editable forms at the same page as well. It is obviously out of the scope of current implementation.

Thank you for feed-back
Björn



--
View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Multiple-forms-at-the-same-page-tp4656436p4656451.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