Error when using xforms:action with xforms:setValue

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

Error when using xforms:action with xforms:setValue

Stephanie Hall (TT)

Hi,

 

I keep running into errors when trying to run the following code:

 

<xforms:action ev:event="xforms-ready">

      <xforms:setValue ref="instance('categories-instance')/categories"

            value="xxforms:call-xpl('http://localhost:8080/forms/categories.xpl', instance('categories-instance'),'formatted-output')/*, 'output')"/>

</xforms:action>

 

The exact error I get each time is: Invalid action: {http://www.w3.org/2002/xforms}setValue.  My purpose here is try to populate an instance using a pipeline, but I don’t think it’s even getting there. Can anyone tell me what I am doing wrong to cause this error?   It would probably be better if the error message told me what I was doing wrong, because I’ve seen people use xforms:action with setValue in some of the archives with no errors.

 

More detail, from the logs:

 

009-11-10 16:18:51,910 ERROR ProcessorService  - Exception at line 24 of oxf:/config/xforms-widgets.xsl (running XForms action: action name='{http://www.w3.org/2002/xforms}setValue')

org.orbeon.oxf.common.ValidationException: line 24 of oxf:/config/xforms-widgets.xsl (running XForms action: action name='{http://www.w3.org/2002/xforms}setValue'): Invalid action: {http://www.w3.org/2002/xforms}setValue

oxf:/config/xforms-widgets.xsl, line 24, column -1: Invalid action: {http://www.w3.org/2002/xforms}setValue

                at org.orbeon.oxf.xforms.action.XFormsActionInterpreter.runAction(XFormsActionInterpreter.java:166)

                at org.orbeon.oxf.xforms.action.actions.XFormsActionAction.execute(XFormsActionAction.java:62)

                at org.orbeon.oxf.xforms.action.XFormsActionInterpreter.runSingleIteration(XFormsActionInterpreter.java:286)

                at org.orbeon.oxf.xforms.action.XFormsActionInterpreter.runAction(XFormsActionInterpreter.java:246)

                at org.orbeon.oxf.xforms.event.XFormsEventHandlerImpl.handleEvent(XFormsEventHandlerImpl.java:153)

                at org.orbeon.oxf.xforms.xbl.XBLContainer.dispatchEvent(XBLContainer.java:878)

                at org.orbeon.oxf.xforms.XFormsContainingDocument.dispatchEvent(XFormsContainingDocument.java:999)

                at org.orbeon.oxf.xforms.xbl.XBLContainer.initializeModels(XBLContainer.java:289)

                at org.orbeon.oxf.xforms.xbl.XBLContainer.initializeModels(XBLContainer.java:267)

                at org.orbeon.oxf.xforms.XFormsContainingDocument.initialize(XFormsContainingDocument.java:1414)

                at org.orbeon.oxf.xforms.XFormsContainingDocument.<init>(XFormsContainingDocument.java:179)

                at org.orbeon.oxf.xforms.processor.XFormsToXHTML.createCacheContainingDocument(XFormsToXHTML.java:325)

 

Thanks!

Stephanie



--
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: Error when using xforms:action with xforms:setValue

Steve Bayliss
Message
Hi Stephanie
 
Your error I think is because xforms:setValue should be xforms:setvalue.
 
However, the "ref" attribute of xforms:setvalue is a single node binding (http://www.w3.org/TR/xforms/#action-setvalue) - from your code it looks like you are attempting to update all or part of an instance (ie more than one node) - I don't think that will work.
 
Instead consider defining a submission to update the instance, and within your xforms:action have an xforms:send to kick off the submission.
 
Also, instead of calling your XPL directly, an alternative approach is to define a URL in your page-flow.xml which executes the XPL, and call that URL to update your instance.
 
Regards
Steve
-----Original Message-----
From: Stephanie Hall (TT) [mailto:[hidden email]]
Sent: 10 November 2009 22:25
To: [hidden email]
Subject: [ops-users] Error when using xforms:action with xforms:setValue

Hi,

 

I keep running into errors when trying to run the following code:

 

<xforms:action ev:event="xforms-ready">

      <xforms:setValue ref="instance('categories-instance')/categories"

            value="xxforms:call-xpl('http://localhost:8080/forms/categories.xpl', instance('categories-instance'),'formatted-output')/*, 'output')"/>

</xforms:action>

 

The exact error I get each time is: Invalid action: {http://www.w3.org/2002/xforms}setValue.  My purpose here is try to populate an instance using a pipeline, but I don’t think it’s even getting there. Can anyone tell me what I am doing wrong to cause this error?   It would probably be better if the error message told me what I was doing wrong, because I’ve seen people use xforms:action with setValue in some of the archives with no errors.

 

More detail, from the logs:

 

009-11-10 16:18:51,910 ERROR ProcessorService  - Exception at line 24 of oxf:/config/xforms-widgets.xsl (running XForms action: action name='{http://www.w3.org/2002/xforms}setValue')

org.orbeon.oxf.common.ValidationException: line 24 of oxf:/config/xforms-widgets.xsl (running XForms action: action name='{http://www.w3.org/2002/xforms}setValue'): Invalid action: {http://www.w3.org/2002/xforms}setValue

oxf:/config/xforms-widgets.xsl, line 24, column -1: Invalid action: {http://www.w3.org/2002/xforms}setValue

                at org.orbeon.oxf.xforms.action.XFormsActionInterpreter.runAction(XFormsActionInterpreter.java:166)

                at org.orbeon.oxf.xforms.action.actions.XFormsActionAction.execute(XFormsActionAction.java:62)

                at org.orbeon.oxf.xforms.action.XFormsActionInterpreter.runSingleIteration(XFormsActionInterpreter.java:286)

                at org.orbeon.oxf.xforms.action.XFormsActionInterpreter.runAction(XFormsActionInterpreter.java:246)

                at org.orbeon.oxf.xforms.event.XFormsEventHandlerImpl.handleEvent(XFormsEventHandlerImpl.java:153)

                at org.orbeon.oxf.xforms.xbl.XBLContainer.dispatchEvent(XBLContainer.java:878)

                at org.orbeon.oxf.xforms.XFormsContainingDocument.dispatchEvent(XFormsContainingDocument.java:999)

                at org.orbeon.oxf.xforms.xbl.XBLContainer.initializeModels(XBLContainer.java:289)

                at org.orbeon.oxf.xforms.xbl.XBLContainer.initializeModels(XBLContainer.java:267)

                at org.orbeon.oxf.xforms.XFormsContainingDocument.initialize(XFormsContainingDocument.java:1414)

                at org.orbeon.oxf.xforms.XFormsContainingDocument.<init>(XFormsContainingDocument.java:179)

                at org.orbeon.oxf.xforms.processor.XFormsToXHTML.createCacheContainingDocument(XFormsToXHTML.java:325)

 

Thanks!

Stephanie



--
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: RE: Error when using xforms:action with xforms:setValue

Stephanie Hall (TT)
Message

Hi Steve,

 

Ah, yes that would be it.  Don’t I feel stupid? J

 

Regarding the XPL, I have to call it directly as I am using a separate deployment scheme and thus have no page-flow.xml.  I will try using the submission method and see if that might work better for what I am trying to do.  This would all be so much easier if we could access the model from the DOM…  If any devs are reading this, could it be possible to make that a setting?   

 

Thanks!

Stephanie

 

From: Steve Bayliss [mailto:[hidden email]]
Sent: Wednesday, November 11, 2009 5:47 AM
To: [hidden email]
Subject: [ops-users] RE: Error when using xforms:action with xforms:setValue

 

Hi Stephanie

 

Your error I think is because xforms:setValue should be xforms:setvalue.

 

However, the "ref" attribute of xforms:setvalue is a single node binding (http://www.w3.org/TR/xforms/#action-setvalue) - from your code it looks like you are attempting to update all or part of an instance (ie more than one node) - I don't think that will work.

 

Instead consider defining a submission to update the instance, and within your xforms:action have an xforms:send to kick off the submission.

 

Also, instead of calling your XPL directly, an alternative approach is to define a URL in your page-flow.xml which executes the XPL, and call that URL to update your instance.

 

Regards

Steve

-----Original Message-----
From: Stephanie Hall (TT) [mailto:[hidden email]]
Sent: 10 November 2009 22:25
To: [hidden email]
Subject: [ops-users] Error when using xforms:action with xforms:setValue

Hi,

 

I keep running into errors when trying to run the following code:

 

<xforms:action ev:event="xforms-ready">

      <xforms:setValue ref="instance('categories-instance')/categories"

            value="xxforms:call-xpl('http://localhost:8080/forms/categories.xpl', instance('categories-instance'),'formatted-output')/*, 'output')"/>

</xforms:action>

 

The exact error I get each time is: Invalid action: {http://www.w3.org/2002/xforms}setValue.  My purpose here is try to populate an instance using a pipeline, but I don’t think it’s even getting there. Can anyone tell me what I am doing wrong to cause this error?   It would probably be better if the error message told me what I was doing wrong, because I’ve seen people use xforms:action with setValue in some of the archives with no errors.

 

More detail, from the logs:

 

009-11-10 16:18:51,910 ERROR ProcessorService  - Exception at line 24 of oxf:/config/xforms-widgets.xsl (running XForms action: action name='{http://www.w3.org/2002/xforms}setValue')

org.orbeon.oxf.common.ValidationException: line 24 of oxf:/config/xforms-widgets.xsl (running XForms action: action name='{http://www.w3.org/2002/xforms}setValue'): Invalid action: {http://www.w3.org/2002/xforms}setValue

oxf:/config/xforms-widgets.xsl, line 24, column -1: Invalid action: {http://www.w3.org/2002/xforms}setValue

                at org.orbeon.oxf.xforms.action.XFormsActionInterpreter.runAction(XFormsActionInterpreter.java:166)

                at org.orbeon.oxf.xforms.action.actions.XFormsActionAction.execute(XFormsActionAction.java:62)

                at org.orbeon.oxf.xforms.action.XFormsActionInterpreter.runSingleIteration(XFormsActionInterpreter.java:286)

                at org.orbeon.oxf.xforms.action.XFormsActionInterpreter.runAction(XFormsActionInterpreter.java:246)

                at org.orbeon.oxf.xforms.event.XFormsEventHandlerImpl.handleEvent(XFormsEventHandlerImpl.java:153)

                at org.orbeon.oxf.xforms.xbl.XBLContainer.dispatchEvent(XBLContainer.java:878)

                at org.orbeon.oxf.xforms.XFormsContainingDocument.dispatchEvent(XFormsContainingDocument.java:999)

                at org.orbeon.oxf.xforms.xbl.XBLContainer.initializeModels(XBLContainer.java:289)

                at org.orbeon.oxf.xforms.xbl.XBLContainer.initializeModels(XBLContainer.java:267)

                at org.orbeon.oxf.xforms.XFormsContainingDocument.initialize(XFormsContainingDocument.java:1414)

                at org.orbeon.oxf.xforms.XFormsContainingDocument.<init>(XFormsContainingDocument.java:179)

                at org.orbeon.oxf.xforms.processor.XFormsToXHTML.createCacheContainingDocument(XFormsToXHTML.java:325)

 

Thanks!

Stephanie



--
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
|

Submit trigger: readonly dependant on the validity of fields

Karolin Heiss
Hallo

I try to implement a submit trigger which is read-only dependant on the
validity of fields.
I dont get it. How do I have to define the readonly attribute of the
binding?

trigger:
<xforms:trigger ref="$control/submit-trigger">...

binding:
                <xforms:model id="control-model">
                        <xforms:instance id="control-instance">
                                <control xmlns="">
                                        <submit-trigger/>
                                        <valid>
                                                <LastName>false</LastName>
                                                <FirstName>false</FirstName>
                                        </valid>
                                </control>
                        </xforms:instance>
                        <xforms:bind
nodeset="instance('control-instance')">
                                <xforms:bind nodeset="submit-trigger"
readonly="not(valid/LastName = 'true' and valid/FirstName = 'true')"/>
                                <!--xforms:bind nodeset="submit-trigger"
readonly="true()"/-->
                        </xforms:bind>
                </xforms:model>


You can try my small test code.
Thank you very much for your answer :-)

Karolin


PS: Using the latest nightly build 3.7.1.200911110900





--
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

testxforms.xhtml (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Submit trigger: readonly dependant on the validity of fields

Alessandro  Vernet
Administrator
Karolin,

On Wed, Nov 11, 2009 at 8:20 AM, Karolin Krieg <[hidden email]> wrote:
> I try to implement a submit trigger which is read-only dependant on the
> validity of fields.
> I dont get it. How do I have to define the readonly attribute of the
> binding?

The issue is that in:

<xforms:bind nodeset="submit-trigger" readonly="not(valid/LastName =
'true' and valid/FirstName = 'true')"/>

The readonly expression is evaluated relative to the node pointed to
by nodeset. So it will look for a submit-trigger/valid/LastName and
submit-trigger/valid/FirstName. Instead, you can write:

<xforms:bind nodeset="submit-trigger"
readonly="not(context()/valid/LastName = 'true' and
context()/valid/FirstName = 'true')"/>

(You could also use ".." instead of "context()", but I find context()
cleaner. It is more a matter of personal preference.)

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


--
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: RE: RE: Error when using xforms:action with xforms:setValue

Alessandro  Vernet
Administrator
In reply to this post by Stephanie Hall (TT)
Stephanie,

On Wed, Nov 11, 2009 at 6:35 AM, Stephanie Hall (TT)
<[hidden email]> wrote:
> Regarding the XPL, I have to call it directly as I am using a separate
> deployment scheme and thus have no page-flow.xml.  I will try using the
> submission method and see if that might work better for what I am trying to
> do.  This would all be so much easier if we could access the model from the
> DOM…  If any devs are reading this, could it be possible to make that a
> setting?

Access the model from the DOM? What do you mean by that?

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


--
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

RE: Re: RE: RE: Error when using xforms:action with xforms:setValue

Stephanie Hall (TT)
Hi Alex,

I read in the archives that, via Javascript, we could not do something like "document.getElementById('myModelId')" or "document.getElementById('myInstanceId')" due to hiding them for security reasons.  My point is that it would be really handy to have a setting to be able to update our instances/model via javascript which we currently cannot do.

Thanks,
Stephanie

-----Original Message-----
From: Alessandro Vernet [mailto:[hidden email]]
Sent: Wednesday, November 11, 2009 4:47 PM
To: [hidden email]
Subject: [ops-users] Re: RE: RE: Error when using xforms:action with xforms:setValue

Stephanie,

On Wed, Nov 11, 2009 at 6:35 AM, Stephanie Hall (TT) <[hidden email]> wrote:
> Regarding the XPL, I have to call it directly as I am using a separate
> deployment scheme and thus have no page-flow.xml.  I will try using
> the submission method and see if that might work better for what I am
> trying to do.  This would all be so much easier if we could access the
> model from the DOM...  If any devs are reading this, could it be
> possible to make that a setting?

Access the model from the DOM? What do you mean by that?

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ My Twitter: http://twitter.com/avernet


--
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: RE: Re: RE: RE: Error when using xforms:action with xforms:setValue

Markku Laine
Stephanie,


> I read in the archives that, via Javascript, we could not do  
> something like "document.getElementById('myModelId')" or  
> "document.getElementById('myInstanceId')" due to hiding them for  
> security reasons.  My point is that it would be really handy to have  
> a setting to be able to update our instances/model via javascript  
> which we currently cannot do.

Have you read this proposal about XForms-JavaScript integration: http://wiki.orbeon.com/forms/projects/client-side-api-for-custom-javascript-widgets

As far as I know, it has not implemented yet but it looks really good,  
though.

If you want to modify Instance Data via JavaScript you can do that by  
binding the elements you want to modify to hidden input fields. Then  
just use JavaScript for modifying the value in that hidden input field  
and it will be updated to the Instance Data.

BR


-Markku


--
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: Re: RE: Re: RE: RE: Error when using xforms:action with xforms:setValue

Markku Laine

On 12.11.2009, at 16.49, Markku Laine wrote:

> Stephanie,
>
>
>> I read in the archives that, via Javascript, we could not do  
>> something like "document.getElementById('myModelId')" or  
>> "document.getElementById('myInstanceId')" due to hiding them for  
>> security reasons.  My point is that it would be really handy to  
>> have a setting to be able to update our instances/model via  
>> javascript which we currently cannot do.
>
> Have you read this proposal about XForms-JavaScript integration: http://wiki.orbeon.com/forms/projects/client-side-api-for-custom-javascript-widgets
>
> As far as I know, it has not implemented yet but it looks really  
> good, though.
>
> If you want to modify Instance Data via JavaScript you can do that  
> by binding the elements you want to modify to hidden input fields.  
> Then just use JavaScript for modifying the value in that hidden  
> input field and it will be updated to the Instance Data.
Here is an example how to do it (haven't run the code so it might  
contain mistakes).

<head>
   ...
   <script type="text/javascript">
     var your-variable = "Hello World!"; // Set value to a variable  
using JavaScript
     ORBEON.xforms.Document.setValue( "your-element", your-
variable ); // Set value to an element (Instance Data) using JavaScript
   </script>
   ...
   <xforms:instance id="your-instance">
     <your-instance xmlns="">
       <your-element />
     </your-instance>
   </xforms:instance>
   ...
</head>
<body>
   ...
   <xforms:input class="hidden" id="your-element" ref="instance( 'your-
instance' )/your-element" />
   ...
</body>


--
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
|

Antw: Re: Submit trigger: readonly dependant on the validity of fields

Karolin Heiss
In reply to this post by Alessandro Vernet
Hey Alex

Thank you very much for your quick help :-)

Karo


>>> Alessandro Vernet <[hidden email]> 11/11/2009 9:31  >>>
Karolin,

On Wed, Nov 11, 2009 at 8:20 AM, Karolin Krieg
<[hidden email]> wrote:
> I try to implement a submit trigger which is read-only dependant on
the
> validity of fields.
> I dont get it. How do I have to define the readonly attribute of the
> binding?

The issue is that in:

<xforms:bind nodeset="submit-trigger" readonly="not(valid/LastName =
'true' and valid/FirstName = 'true')"/>

The readonly expression is evaluated relative to the node pointed to
by nodeset. So it will look for a submit-trigger/valid/LastName and
submit-trigger/valid/FirstName. Instead, you can write:

<xforms:bind nodeset="submit-trigger"
readonly="not(context()/valid/LastName = 'true' and
context()/valid/FirstName = 'true')"/>

(You could also use ".." instead of "context()", but I find context()
cleaner. It is more a matter of personal preference.)

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/ 
My Twitter: http://twitter.com/avernet


--
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