Hi Dan,

Since I was not able to replicate the hello2 example from
http://exist-db.org/exist/xforms/hello2.xml (see above) I am now trying to
get your example 1.8 running
http://www.danmccreary.com/xrx/beginners-guide/beginners-guide-to-xrx.xhtml#ex.edit.xq

Unfortunately, this doesn't work, too.

I copied and pasted example 1.8 under /db/apps/terms/edit/edit.xq
Did some corrections, namely replaced

xmlns:xs="http://www.w3.org/2001/<acronym>XML</acronym>Schema"

by

xmlns:xs="http://www.w3.org/2001/XMLSchema";

copied and pasted

*Example 1.10. /db/apps/terms/edit/next-id.xml*

*Example 1.11. /db/apps/terms/edit/save-new.xq*

Because $file in edit.xq refers to a file named "new-instance.xml", I

created a file /db/apps/terms/data/new-instance.xml with the following content:

**

*<term>*

*    <id></id>*

*    <term-name>my name</term-name>*

*    <definition></definition>*

*    <publish-status-code></publish-status-code>*

*</term>*

**

*Now I was able to load edit.xq?new=true and it was displayed as expected.*

*However, when I pushed the Save button, nothing happened. Hence,
something is wrong either with XSLTform.xsl or with the example.*

Again I tried to understand what is (supposed to) going on with the
submission element. First of all I don't understand why the instance
attribute has the value "my-task".

My guess is that it should point to an existing instance in the model.
Yet there is no instance named "my-task", but only one named
"save-data". Therefore I changed the value of the instance attribute
in the submission element accordingly.

Still pushing the safe button didn't yield any effect.

Then I read about Alain'2 comment that "AVT for XForms submission is
not supported". But that didn't help me any further.

It would be great to have a working example!

- Immanuel



2012/11/1 Dan McCreary <[email protected]>

> Hi Immanuel,
>
> Perhaps you should consider using HTTP POST and creating a save.xq
> similar to the one in the Beginner's Guide.  The problem with PUT is
> that you must make sure that you have write access and this opens up
> security concerns.  HTTP POST allows you to use the request:get-data()
> to get the incoming data file and then do an xmldb:store()
>
> Here is the submission line:
>
> <xf:submission id="save" method="post" action="{if ($new='true') then
> ('save-new.xq') else ('update.xq')}" instance="my-task"
> replace="all"/>
>
>
> http://www.danmccreary.com/xrx/beginners-guide/beginners-guide-to-xrx.xhtml#d0e733
>
> - Dan
>
> On Wed, Oct 31, 2012 at 6:06 PM, Immanuel Normann
> <[email protected]> wrote:
> > Hi,
> >
> > I still try to understand how submission put and get works. Exist-db
> comes
> > with the example
> > exist/webapp/xforms/hello2.xml (I assume it is known to you?! see
> > http://exist-db.org/exist/xforms/hello2.xml).
> >
> > This example works basically as one expects. In order to learn from it I
> > made copy to
> >
> > /db/my-hello.xml
> >
> > and changed only two paths in that file to fit to my setting:
> >
> >   <xf:submission id="put-to-db" method="put" replace="none"
> > resource="../rest/db/xforms-example-hello2.xml">
> >
> > to
> >
> >   <xf:submission id="put-to-db" method="put" replace="none"
> > resource="/exist/rest/db/xforms-example-my-hello.xml">
> >
> > and
> >
> >
> >    <xf:submission id="get-from-db" method="get" replace="instance"
> >
> resource="../rest/db/xforms-example-hello2.xml?_query=/person&amp;_wrap=no">
> >
> > to
> >     <xf:submission id="get-from-db" method="get" replace="instance"
> >
> resource="/exist/rest/db/xforms-example-my-hello.xml?_query=/person&amp;_wrap=no">
> >
> > And this is my problem:
> >
> > Let's say the initial content of
> /exist/rest/db/xforms-example-my-hello.xml
> > is
> >
> > <person>
> >     <name>Otto</name>
> > </person>
> >
> > When I go to http://localhost:8080/exist/rest/db/my-hello.xmleverything is
> > displayed as in the hello2 example.
> >
> > Now I type in the text: Anna
> > and push the button: Safe
> >
> > This changes /exist/rest/db/xforms-example-my-hello.xml to:
> >
> > <person>
> >   <name>Anna</name>
> >   <name>Otto</name>
> >   <name/>
> >   <name/>
> >   <test/>
> >   <name/>
> > </person>
> >
> > Actually this is the same effect as in the hello2 example. The first
> > question here: why is
> >
> >   <name/>
> >   <name/>
> >   <test/>
> >   <name/>
> >
> > added? I would expect only a change to
> >
> > <person>
> >   <name>Anna</name>
> >   <name>Otto</name>
> > </person>
> >
> > But even more strange is the effect of the following interaction:
> >
> > Let's start again with
> >
> > <person>
> >     <name>Otto</name>
> > </person>
> >
> > Now I type again the text: Anna
> > but push then the button: Refresh from DB
> >
> > Still the content of  xforms-example-my-hello.xml is (as expected):
> >
> > <person>
> >     <name>Otto</name>
> > </person>
> >
> > However, when I type again: Anna
> > And then push the button: Safe
> >
> > Then the content of xforms-example-my-hello.xml is:
> >
> > <exist:result>
> >   <name>Anna</name>
> > </exist:result>
> >
> > That's not I would expect. Instead I would expect again:
> >
> > <person>
> >   <name>Anna</name>
> >   <name>Otto</name>
> > </person>
> >
> > For me the behaviour of submission is thus rather unpredictable. Or do
> you
> > have an explanation? I would be very happy to learn how this submission
> > really works.
> >
> > Immanuel
> >
> >
> >
> ------------------------------------------------------------------------------
> > Everyone hates slow websites. So do we.
> > Make your web apps faster with AppDynamics
> > Download AppDynamics Lite for free today:
> > http://p.sf.net/sfu/appdyn_sfd2d_oct
> > _______________________________________________
> > Xsltforms-support mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/xsltforms-support
> >
>
>
>
> --
> Dan McCreary
> NoSQL Evangelist
> office: (952) 931-9198
> cell: (612) 986-1552
>
------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
Xsltforms-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xsltforms-support

Reply via email to