Problem in range control

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

Problem in range control

Pierre-Julien VILLOUD
Hi everyone,
It's been a month now that I am working with Orbeon for my internship and i'm confronted with several issues.

Let's start by the range control. All the examples i've seen on the web use defined values for the fields start end and step : start="1" ...

Here is the problem, I would like to get the values in a XML file. So I tried :
start="doc(path/file.xml)/value" but I have the error Error input string ...
even start="instance('instance')/value" doesn't work.

So I don't know if there is a problem of type (string instead of integer maybe) or if it's not possible to use functions in these attributes.

Any help is appreciated !

Thank you

Pierre-Julien



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Problem in range control

Erik Bruchez
Administrator
Pierre-Julien,

The best way to look at this is for you to create a simple reproducible
example that works in the XForms sandbox, and send it to the list (as an
attachment).

-Erik

[hidden email] wrote:

> Hi everyone,
> It's been a month now that I am working with Orbeon for my internship and i'm confronted with several issues.
>
> Let's start by the range control. All the examples i've seen on the web use defined values for the fields start end and step : start="1" ...
>
> Here is the problem, I would like to get the values in a XML file. So I tried :
> start="doc(path/file.xml)/value" but I have the error Error input string ...
> even start="instance('instance')/value" doesn't work.
>
> So I don't know if there is a problem of type (string instead of integer maybe) or if it's not possible to use functions in these attributes.
>
> Any help is appreciated !
>
> Thank you
>
> Pierre-Julien
--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Problem in range control

Pierre-Julien VILLOUD
Here is an example of what I'd like to do. But I have the error :
XForms error: For input string...

Thank you !


--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

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

Re: Problem in range control

Erik Bruchez
Administrator
Pierre-Julien,

According to the spec, the values for @start, @end and @step must be
numbers. They can't be XPath expressions. But you write this:

   start="/instance/Min"
   end="/instance/Max"
   step="/instance/step"

which is illegal in XForms.

I think that we should support attribute value templates in
xforms:range, so you could write:

   start="{/instance/Min}"

etc. But this is not yet supported. I entered an RFE for this:

http://forge.objectweb.org/tracker/index.php?func=detail&aid=307013&group_id=168&atid=350207

-Erik

Pierre-Julien VILLOUD wrote:
> Here is an example of what I'd like to do. But I have the error :
> XForms error: For input string...
>
> Thank you !
>


--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Problem in range control

Pierre-Julien VILLOUD
Thank you for entering an RFE, I hope it will be supported soon.
So how could i do to deal without the range control ?
I thought something like that

<xforms:select1 ref="instance('needs')/group/Element[last()]/value">
{
for $x in (1 to 10)
return
<xforms:item>
<xforms:label>{$x}</xforms:label>
<xforms:value>{$x}</xforms:value>
</xforms:item>
}
</xforms:select1>

But i must be wrong because it doesn't work.

I saw that kind of solutions in the w3schools tutorial, that's why i'm
suprised...



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Problem in range control

Erik Bruchez
Administrator
Pierre-Julien VILLOUD wrote:

> Thank you for entering an RFE, I hope it will be supported soon.
> So how could i do to deal without the range control ?
> I thought something like that
>
> <xforms:select1 ref="instance('needs')/group/Element[last()]/value">
> {
> for $x in (1 to 10)
> return
> <xforms:item>
> <xforms:label>{$x}</xforms:label>
> <xforms:value>{$x}</xforms:value>
> </xforms:item>
> }
> </xforms:select1>
>
> But i must be wrong because it doesn't work.
>
> I saw that kind of solutions in the w3schools tutorial, that's why i'm
> suprised...
It seems you are mixing up tutorials ;-) The above looks like XQuery
producing XForms. You could do that with Orbeon Forms is you explicitly
hook-up the XQuery processor. Easier would be to use XSLT instead, as
that requires you to just add xsl:version="2.0" on the root element of
your page. Then you can write:

<xsl:for-each select="(1 to 10)">
   <xforms:item>
     <xforms:label><xsl:value-of select="."/></xforms:label>
     <xforms:value><xsl:value-of select="."/></xforms:value>
   </xforms:item>
</xsl:for-each>>

-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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Problem in range control

Pierre-Julien VILLOUD
Ok thank you it works with '(1 to 10)' but I would like to pick up the
value in an XML document or in an instance and it doesn't seem to
work...

It's not possible to do this ?

...
<xsl:for-each select="(/Query/Min to /Query/Max)">
...


Thank you !

Pierre-Julien

> It seems you are mixing up tutorials ;-) The above looks like XQuery
> producing XForms. You could do that with Orbeon Forms is you explicitly
> hook-up the XQuery processor. Easier would be to use XSLT instead, as
> that requires you to just add xsl:version="2.0" on the root element of
> your page. Then you can write:
>
> <xsl:for-each select="(1 to 10)">
>    <xforms:item>
>      <xforms:label><xsl:value-of select="."/></xforms:label>
>      <xforms:value><xsl:value-of select="."/></xforms:value>
>    </xforms:item>
> </xsl:for-each>>
>
> -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
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>


--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Problem in range control

Erik Bruchez
Administrator
Pierre-Julien,

First a preceision about the architecture: the XSLT step is really just
a way to pre-process the XForms document before it is sent to the XForms
engine. You could do this in JSP, Perl, or anything else - here we just
happen to use XSLT as a pre-processing step.

This means that the value of the XPath expression in:

   <xsl:for-each select="(/Query/Min to /Query/Max)">

is computed before the XForms engine is even called.

But what you can do is extract URL parameters into a document, as
documented here:

   http://www.orbeon.com/ops/doc/reference-page-flow#url-extraction

Assume you store the information to an XML document that looks like:

<Query>
   <Min>1</Min>
   <Max>100</Max>
</Query>

Then you can use, from XSLT, something like:

   (doc('input:instance')/Query/Min to doc('input:instance')/Query/Max)

-Erik

Pierre-Julien VILLOUD wrote:

> Ok thank you it works with '(1 to 10)' but I would like to pick up the
> value in an XML document or in an instance and it doesn't seem to
> work...
>
> It's not possible to do this ?
>
> ...
> <xsl:for-each select="(/Query/Min to /Query/Max)">
> ...
>
>
> Thank you !
>
> Pierre-Julien
>> It seems you are mixing up tutorials ;-) The above looks like XQuery
>> producing XForms. You could do that with Orbeon Forms is you explicitly
>> hook-up the XQuery processor. Easier would be to use XSLT instead, as
>> that requires you to just add xsl:version="2.0" on the root element of
>> your page. Then you can write:
>>
>> <xsl:for-each select="(1 to 10)">
>>    <xforms:item>
>>      <xforms:label><xsl:value-of select="."/></xforms:label>
>>      <xforms:value><xsl:value-of select="."/></xforms:value>
>>    </xforms:item>
>> </xsl:for-each>>
>>
>> -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
>> ObjectWeb mailing lists service home page: http://www.objectweb.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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Problem in range control

Pierre-Julien VILLOUD
Thanks for your help...
As the xml file containing the Min/Max values to load is defined in
the form, i can't use XSLT. Anyway I found another solution, I built a
temporary instance and I simply load it in the select...

Pierre-Julien



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws