Range Control

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

Range Control

Paul Saxelby
Hi,

Real newbie question coming up...
(I hope this is the right way & place to post)

I'm trying to set up a form and want to use a range control. The control is displaying ok, it's linked to the model ok, I have attributes set to min="1" max="5" step="1".

The control works, but it's appearance will be confusing. It is set to have a range of 5 to map onto a questionnaire response set ranging from strongly disagree to strongly agree over 5 steps.
The control though is displaying 9 dividers.

How do I bring this down to 5 please?

I need a 1-1 mapping between numerical & visual value.

Also, could you please tell me why this particular medium was chosen for this type of support? I'd have thought an online forum would have been much easier to use...

Many thanks (to whomever I'm sending this to),

Paul Saxelby



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

Conditions and iterations

Markku Laine
Hi mates,


I am trying to implement a simple list editor, in which items can be
selected or delected.

I have attached two examples which both try to solve the problem
with different approaches. This is just a dummy use case to describe my
real problem related to a list editor I am developing.

Personally, I prefer the first approach (listeditor1.xhtml) because it
separates the UI related temporary data from the actual data. There the
problem is that I don't know how to create a proper condition to show/hide
a block of code.

The second approach (listeditor2.xhtml) works okay, if I include some UI
related temporary data (attributes) to the actual data in advance.
However, I would not like to/can not do that because the data, which is
loaded to the application, does not have those attributes. When I am
trying to add the needed attributes at the time of the xforms-ready event,
I fail to do that because of the context attribute of the xforms:insert
element does not accept values from other instances (see the code
example).

I am not an extreme XForms programmer so my questions is, is it even
possible to implement a condition(s) to listeditor1.xhtml and how should I
use the iteration of XForms actions to accomplish the task in
listeditor2.xhtml?

Thanks in advance!


-Markku Laine

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

listeditor2.xhtml (7K) Download Attachment
listeditor1.xhtml (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Range Control

Alessandro Vernet
Administrator
In reply to this post by Paul Saxelby
On 6/19/07, [hidden email] <[hidden email]> wrote:
> Real newbie question coming up...
> (I hope this is the right way & place to post)

Yes, you have indeed found the right place! :)

> The control works, but it's appearance will be confusing. It is set to have a range of 5 to map onto a questionnaire response set ranging from strongly disagree to strongly agree over 5 steps.
> The control though is displaying 9 dividers.
>
> How do I bring this down to 5 please?

Good point. Right now the range control has a few limitation, and this
one is one of them. I create a bug for this, which you can track at
the URL below. In the meantime maybe you can use a drop down, or radio
buttons for this?

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

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
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: Conditions and iterations

Alessandro Vernet
Administrator
In reply to this post by Markku Laine
Hi Markku,

You can do what you are looking by adding a binding expression to the
triggers and use there a predicate that returns false when you want to
disable the trigger.

The "select" trigger becomes:
<xforms:trigger appearance="minimal" ref=".[not(@id =
instance('selectedpersonlist-instance')/selectedperson)]">

The "deselect" trigger becomes:
<xforms:trigger appearance="minimal" ref=".[@id =
instance('selectedpersonlist-instance')/selectedperson]">

I have also attached the full modified file. (You will see I added the
XForms inspector, so I could quickly see the instances and how they
are modified.)

Alex

On 6/19/07, .::: Markku :::. <[hidden email]> wrote:

> Hi mates,
>
>
> I am trying to implement a simple list editor, in which items can be
> selected or delected.
>
> I have attached two examples which both try to solve the problem
> with different approaches. This is just a dummy use case to describe my
> real problem related to a list editor I am developing.
>
> Personally, I prefer the first approach (listeditor1.xhtml) because it
> separates the UI related temporary data from the actual data. There the
> problem is that I don't know how to create a proper condition to show/hide
> a block of code.
>
> The second approach (listeditor2.xhtml) works okay, if I include some UI
> related temporary data (attributes) to the actual data in advance.
> However, I would not like to/can not do that because the data, which is
> loaded to the application, does not have those attributes. When I am
> trying to add the needed attributes at the time of the xforms-ready event,
> I fail to do that because of the context attribute of the xforms:insert
> element does not accept values from other instances (see the code
> example).
>
> I am not an extreme XForms programmer so my questions is, is it even
> possible to implement a condition(s) to listeditor1.xhtml and how should I
> use the iteration of XForms actions to accomplish the task in
> listeditor2.xhtml?
>
> Thanks in advance!
>
>
> -Markku Laine
>
> --
> 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 2.0 Forms, open-source, for the Enterprise
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: Conditions and iterations

Markku Laine
Hi Alex,


> You can do what you are looking by adding a binding expression to the
> triggers and use there a predicate that returns false when you want to
> disable the trigger.

Thanks, in the meanwhile I managed to put up some kind of group condition
(if condition) by myself but it wasn't as good as yours. In my opinion,
XForms is lacking of clear and user friendly if-else and iteration
commands. At the moment, iteration can be done with xforms:repeat and
actions's while attribute. If-else blocks can be done with relevant,
xforms:group, etc. Maybe it is just me, but at the moment using
ref=".[not(@id = instance( 'mysecond-instance' )/id )]" is not the most
obvious way to say, hey I want to do a simple if condition. But I am
adapting myself in ones and twos to understand the XForms programming
model (and other XML technologies :)


> I have also attached the full modified file. (You will see I added the
> XForms inspector, so I could quickly see the instances and how they
> are modified.)

Did you forget to attach the modified file? Could you re-send the message
with the attachment? Thanks in advance.


In listeditor1.xhtml, I tried to use one of the features released in
XForms 1.1 for repeating an action in xforms:model. What I tried and did
not work was:

<xforms:action ev:event="xforms-ready">
   <xforms:setvalue ref="instance( 'helper-instance' )/counter" value="1" />
   <xforms:action while="instance( 'helper-instance' )/counter &lt;= count( instance( 'personlist-instance' )/person )">
     <!-- Is it possible to refer to an other instance inside the context attribute of the xforms:insert element? -->
     <xforms:insert origin="instance( 'person-instance' )/@selected" nodeset="@selected" context="instance( 'personlist-instance' )/person[ instance( 'helper-instance' )/counter ]" />
     <xforms:setvalue ref="instance( 'helper-instance' )/counter" value=". + 1" />
   </xforms:action>
</xforms:action>

I managed to fix this by converting instance( 'helper-instance' )/counter
to number in the context attribute of the xforms:insert element.

<xforms:insert origin="instance( 'person-instance' )/@selected" nodeset="@selected" context="instance( 'personlist-instance' )/person[ number( instance( 'personlist-instance' )/counter ) ]" />

First, I thought that there might be a but in implementing the feature but
the type of the "counter" was wrong, and therefore instance(
'helper-instance' )/counter returned 1 at each iteration round.

A common mistake, which is quite hard to detect.

Regards


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

Re: Conditions and iterations

Alessandro Vernet
Administrator
Markku,

On 6/26/07, .::: Markku :::. <[hidden email]> wrote:

> Thanks, in the meanwhile I managed to put up some kind of group condition
> (if condition) by myself but it wasn't as good as yours. In my opinion,
> XForms is lacking of clear and user friendly if-else and iteration
> commands. At the moment, iteration can be done with xforms:repeat and
> actions's while attribute. If-else blocks can be done with relevant,
> xforms:group, etc. Maybe it is just me, but at the moment using
> ref=".[not(@id = instance( 'mysecond-instance' )/id )]" is not the most
> obvious way to say, hey I want to do a simple if condition. But I am
> adapting myself in ones and twos to understand the XForms programming
> model (and other XML technologies :)
Yes, using a bind expression of the form .[condition] to hide some
markup based on some condition is kind of a "trick". The more
"traditional" way to do this is to bind the control to a node and make
that node non-relevant with a <xforms:bind> expression. But of course
this is more verbose. Maybe future versions of XForms will allow you
to put expressions like relevant="..." directly on controls.

> Did you forget to attach the modified file? Could you re-send the message
> with the attachment? Thanks in advance.

Yes, sorry, I indeed forgot to attach the file. So here it is attached
to this email.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
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

listeditor1.xhtml (6K) Download Attachment