Single Checkbox Production and Its Binding

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

Single Checkbox Production and Its Binding

Spenser Kao

I have been thinking of creating a *single* checkbox whose checked or unchecked value will decide whether a succeeding input box is enabled or not.

 

At [1], the use of XForms’ select-choices-item approach is demonstrated to produce checkbox, but it appears to be meaningful only when multiple check boxes are expected, am I right on this perception?

 

I tried the <xhtml:input type=”checkbox”  ..> approach, and it produces what I wanted: a single checkbox, but I am still looking for the solution of binding it to the succeeding input box. Does anyone know how to do that?

 

Regards,

 

Spenser

 

[1] http://www.orbeon.com/ops/doc/reference-xforms-ng

 

 

 

 



--
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: Single Checkbox Production and Its Binding

Adrian Baker
You could try using a <xforms:select1> - see http://mail-archive.objectweb.org/ops-users/2006-07/msg00041.html - to set a boolean flag which could be used to control the display of your input.

Adrian

Spenser Kao wrote:

I have been thinking of creating a *single* checkbox whose checked or unchecked value will decide whether a succeeding input box is enabled or not.

 

At [1], the use of XForms’ select-choices-item approach is demonstrated to produce checkbox, but it appears to be meaningful only when multiple check boxes are expected, am I right on this perception?

 

I tried the <xhtml:input type=”checkbox”  ..> approach, and it produces what I wanted: a single checkbox, but I am still looking for the solution of binding it to the succeeding input box. Does anyone know how to do that?

 

Regards,

 

Spenser

 

[1] http://www.orbeon.com/ops/doc/reference-xforms-ng

 

 

 

 


-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: [hidden email] For general help: [hidden email] 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: Single Checkbox Production and Its Binding

Erik Bruchez
Administrator
In reply to this post by Spenser Kao
Spenser Kao wrote:
> I have been thinking of creating a **single** checkbox whose checked or
> unchecked value will decide whether a succeeding input box is enabled or
> not.
>
> At [1], the use of XForms’ select-choices-item approach is demonstrated
> to produce checkbox, but it appears to be meaningful only when multiple
> check boxes are expected, am I right on this perception?

No, you can use only one checkbox.

> I tried the <xhtml:input type=”checkbox”  ..> approach, and it produces
> what I wanted: a single checkbox, but I am still looking for the
> solution of binding it to the succeeding input box. Does anyone know how
> to do that?

You are in trouble if you try to mix HTML controls and XForms controls.
Just use XForms:

<xforms:select>
   <xforms:label/>
   <xforms:item>
     <xforms:label>Select me!</xforms:label>
     <xforms:value>selected</xforms:value>
   </xforms:item>
</xforms:select>

-Erik

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



--
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: Single Checkbox Production and Its Binding

Spenser Kao
Thanks for tips from Adrian and Erik.

But I found a weird symptom described below:
a) If the input field next to the checkbox IS bound to the checkbox
selection result, then the checkbox can have only one-way change: from
checked (ticketed) to unchecked (unticketed) and then the input field will
transit to readonly. But it's not reversible - can't change back to checked
from unchecked.
b) If commented out the statement of binding the input field next to the
checkbox selection result, the checkbox can be toggled.

Anyone has a clue?

But goal is till to be able to toggle the checkbox and reflect it onto the
attribute readonly of the next input field.

Attached is my example, which is actually modified and trimmed down from
view.xhtml of XForms Control example as some may have noticed.
 
Regards,
 
Spenser
--- Start of example ---
<xhtml:html xmlns:xforms="http://www.w3.org/2002/xforms"
    xmlns:f="http://orbeon.org/oxf/xml/formatting"
    xmlns:xhtml="http://www.w3.org/1999/xhtml"
    xmlns:ev="http://www.w3.org/2001/xml-events"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:ui="http:/www.example.org/ui">

    <xhtml:head>
        <xhtml:title>Person Details</xhtml:title>
        <xforms:model>
            <xforms:instance>
                <person id="test">
                   <driverslicence ui:is-optional="true"
ui:is-selected="true" ui:label="Drivers Licence"/>                  
                        </person>  
            </xforms:instance>
            <xforms:bind nodeset=".">              
                <!-- Dim the driverslicence if checkbox is not checked -->
xforms:bind nodeset="driverslicence" readonly="@ui:is-selected = ''"/>
            </xforms:bind>
        </xforms:model>
        <xhtml:style type="text/css">
            .table {
                border-collapse: collapse;
                border-spacing: 0;
            }
            .line {
                padding-top: .2em;
                padding-bottom: .2em;
            }
            .label {
                text-align: right;
                font-weight: bold;
                color: #222;
                padding-right: 1em;
            }  
            .input-text input { width: 15em; }            
            .xforms-repeat-selected-item-1 {
                background: none;
            }
        </xhtml:style>
    </xhtml:head>
    <xhtml:body>
        <xhtml:table class="table">
            <xforms:repeat nodeset="*">
                <xhtml:tr class="line">
                    <xhtml:td align="left" class="label line">
                            <xforms:group ref="@ui:is-optional">

                        <xforms:select ref="../@ui:is-selected"
appearance="full">                    
                        <xforms:item>
                        <xforms:label/>
                        <xforms:value>true</xforms:value>
       
</xforms:item>
                        </xforms:select>

                            </xforms:group>
                    </xhtml:td>                
                    <xhtml:td align="left" class="label line">
                        <xforms:output ref="@ui:label"/>
                    </xhtml:td>
                    <xhtml:td class="line">
                        <xforms:group>
                            <xforms:group ref="@ui:is-optional">
                                <xforms:input ref=".." incremental="true"
readonly="../@ui:is-selected = ''" class="input-text"/>
                            </xforms:group>

                        </xforms:group>
                    </xhtml:td>
                </xhtml:tr>
            </xforms:repeat>
        </xhtml:table>
    </xhtml:body>
</xhtml:html>

-----Original Message-----
From: Erik Bruchez [mailto:[hidden email]] On Behalf Of Erik Bruchez
Sent: Monday, 16 October 2006 10:36 PM
To: [hidden email]
Subject: Re: [ops-users] Single Checkbox Production and Its Binding

Spenser Kao wrote:
> I have been thinking of creating a **single** checkbox whose checked or
> unchecked value will decide whether a succeeding input box is enabled or
> not.
>
> At [1], the use of XForms' select-choices-item approach is demonstrated
> to produce checkbox, but it appears to be meaningful only when multiple
> check boxes are expected, am I right on this perception?

No, you can use only one checkbox.

> I tried the <xhtml:input type="checkbox"  ..> approach, and it produces
> what I wanted: a single checkbox, but I am still looking for the
> solution of binding it to the succeeding input box. Does anyone know how
> to do that?

You are in trouble if you try to mix HTML controls and XForms controls.
Just use XForms:

<xforms:select>
   <xforms:label/>
   <xforms:item>
     <xforms:label>Select me!</xforms:label>
     <xforms:value>selected</xforms:value>
   </xforms:item>
</xforms:select>

-Erik

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/






--
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: Single Checkbox Production and Its Binding

Adrian Baker
Hi Spenser,

I would guess your readonly property on <driverslicence> is being propagated down to the attributes, which means the checkbox is becoming readonly as well as your input. From http://www.w3.org/TR/xforms/slice6.html#model-prop-readOnly:

    "Inheritance Rules: If any ancestor node evaluates to true, this value is treated as true. Otherwise, the local value is used."

You may need to change your instance data structure to get this to work.

Adrian

Spenser Kao wrote:
Thanks for tips from Adrian and Erik.

But I found a weird symptom described below:
a) If the input field next to the checkbox IS bound to the checkbox
selection result, then the checkbox can have only one-way change: from
checked (ticketed) to unchecked (unticketed) and then the input field will
transit to readonly. But it's not reversible - can't change back to checked
from unchecked.
b) If commented out the statement of binding the input field next to the
checkbox selection result, the checkbox can be toggled.

Anyone has a clue?

But goal is till to be able to toggle the checkbox and reflect it onto the
attribute readonly of the next input field.

Attached is my example, which is actually modified and trimmed down from
view.xhtml of XForms Control example as some may have noticed.
 
Regards,
 
Spenser 
--- Start of example ---
<xhtml:html xmlns:xforms="http://www.w3.org/2002/xforms"
    xmlns:f="http://orbeon.org/oxf/xml/formatting"
    xmlns:xhtml="http://www.w3.org/1999/xhtml"
    xmlns:ev="http://www.w3.org/2001/xml-events"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:ui="http:/www.example.org/ui">

    <xhtml:head>
        <xhtml:title>Person Details</xhtml:title>
        <xforms:model>
            <xforms:instance>
                <person id="test">
                   <driverslicence ui:is-optional="true"
ui:is-selected="true" ui:label="Drivers Licence"/>                   
			</person>   
            </xforms:instance>
            <xforms:bind nodeset=".">               
                <!-- Dim the driverslicence if checkbox is not checked -->
xforms:bind nodeset="driverslicence" readonly="@ui:is-selected = ''"/>
            </xforms:bind>
        </xforms:model>
        <xhtml:style type="text/css">
            .table {
                border-collapse: collapse;
                border-spacing: 0;
            }
            .line {
                padding-top: .2em;
                padding-bottom: .2em;
            }
            .label {
                text-align: right;
                font-weight: bold;
                color: #222;
                padding-right: 1em;
            }  
            .input-text input { width: 15em; }            
            .xforms-repeat-selected-item-1 {
                background: none;
            }
        </xhtml:style>
    </xhtml:head>
    <xhtml:body>
        <xhtml:table class="table">
            <xforms:repeat nodeset="*">
                <xhtml:tr class="line">
                    <xhtml:td align="left" class="label line">
	                    <xforms:group ref="@ui:is-optional">

                        <xforms:select ref="../@ui:is-selected"
appearance="full">                     
                        	<xforms:item>
                        		<xforms:label/>
                        		<xforms:value>true</xforms:value>
	
</xforms:item>
                        </xforms:select>

	                    </xforms:group>
                    </xhtml:td>                
                    <xhtml:td align="left" class="label line">
                        <xforms:output ref="@ui:label"/>
                    </xhtml:td>
                    <xhtml:td class="line">
                        <xforms:group>
                            <xforms:group ref="@ui:is-optional">
                                <xforms:input ref=".." incremental="true"
readonly="../@ui:is-selected = ''" class="input-text"/> 
                            </xforms:group>

                        </xforms:group>
                    </xhtml:td>
                </xhtml:tr>
            </xforms:repeat>
        </xhtml:table>
    </xhtml:body>
</xhtml:html>

-----Original Message-----
From: Erik Bruchez [[hidden email]] On Behalf Of Erik Bruchez
Sent: Monday, 16 October 2006 10:36 PM
To: [hidden email]
Subject: Re: [ops-users] Single Checkbox Production and Its Binding

Spenser Kao wrote:
  
I have been thinking of creating a **single** checkbox whose checked or 
unchecked value will decide whether a succeeding input box is enabled or 
not.

At [1], the use of XForms' select-choices-item approach is demonstrated 
to produce checkbox, but it appears to be meaningful only when multiple 
check boxes are expected, am I right on this perception?
    

No, you can use only one checkbox.

  
I tried the <xhtml:input type="checkbox"  ..> approach, and it produces 
what I wanted: a single checkbox, but I am still looking for the 
solution of binding it to the succeeding input box. Does anyone know how 
to do that?
    

You are in trouble if you try to mix HTML controls and XForms controls. 
Just use XForms:

<xforms:select>
   <xforms:label/>
   <xforms:item>
     <xforms:label>Select me!</xforms:label>
     <xforms:value>selected</xforms:value>
   </xforms:item>
</xforms:select>

-Erik

  

-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: [hidden email] For general help: [hidden email] 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: Single Checkbox Production and Its Binding

Spenser Kao

Hi Adrian,

 

Yes, the one-way change indicates that it is the outcome of the logic “OR”ed result of the evaluated readonly property of the local and every ancestor nodes.

I’ll restructure my instance data.

 

Thanks,

 

Spenser


From: Adrian Baker [mailto:[hidden email]]
Sent: Tuesday, 17 October 2006 1:38 PM
To: [hidden email]
Subject: Re: [ops-users] Single Checkbox Production and Its Binding

 

Hi Spenser,

I would guess your readonly property on <driverslicence> is being propagated down to the attributes, which means the checkbox is becoming readonly as well as your input. From http://www.w3.org/TR/xforms/slice6.html#model-prop-readOnly:

    "Inheritance Rules: If any ancestor node evaluates to true, this value is treated as true. Otherwise, the local value is used."

You may need to change your instance data structure to get this to work.

Adrian

Spenser Kao wrote:

Thanks for tips from Adrian and Erik.
 
But I found a weird symptom described below:
a) If the input field next to the checkbox IS bound to the checkbox
selection result, then the checkbox can have only one-way change: from
checked (ticketed) to unchecked (unticketed) and then the input field will
transit to readonly. But it's not reversible - can't change back to checked
from unchecked.
b) If commented out the statement of binding the input field next to the
checkbox selection result, the checkbox can be toggled.
 
Anyone has a clue?
 
But goal is till to be able to toggle the checkbox and reflect it onto the
attribute readonly of the next input field.
 
Attached is my example, which is actually modified and trimmed down from
view.xhtml of XForms Control example as some may have noticed.
 
Regards,
 
Spenser 
--- Start of example ---
<xhtml:html xmlns:xforms="http://www.w3.org/2002/xforms"
    xmlns:f="http://orbeon.org/oxf/xml/formatting"
    xmlns:xhtml="http://www.w3.org/1999/xhtml"
    xmlns:ev="http://www.w3.org/2001/xml-events"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:ui="http:/www.example.org/ui">
 
    <xhtml:head>
        <xhtml:title>Person Details</xhtml:title>
        <xforms:model>
            <xforms:instance>
                <person id="test">
                   <driverslicence ui:is-optional="true"
ui:is-selected="true" ui:label="Drivers Licence"/>                   
                       </person>   
            </xforms:instance>
            <xforms:bind nodeset=".">               
                <!-- Dim the driverslicence if checkbox is not checked -->
xforms:bind nodeset="driverslicence" readonly="@ui:is-selected = ''"/>
            </xforms:bind>
        </xforms:model>
        <xhtml:style type="text/css">
            .table {
                border-collapse: collapse;
                border-spacing: 0;
            }
            .line {
                padding-top: .2em;
                padding-bottom: .2em;
            }
            .label {
                text-align: right;
                font-weight: bold;
                color: #222;
                padding-right: 1em;
            }  
            .input-text input { width: 15em; }            
            .xforms-repeat-selected-item-1 {
                background: none;
            }
        </xhtml:style>
    </xhtml:head>
    <xhtml:body>
        <xhtml:table class="table">
            <xforms:repeat nodeset="*">
                <xhtml:tr class="line">
                    <xhtml:td align="left" class="label line">
                            <xforms:group ref="@ui:is-optional">
 
                        <xforms:select ref="../@ui:is-selected"
appearance="full">                     
                               <xforms:item>
                                      <xforms:label/>
                                      <xforms:value>true</xforms:value>
        
</xforms:item>
                        </xforms:select>
 
                            </xforms:group>
                    </xhtml:td>                
                    <xhtml:td align="left" class="label line">
                        <xforms:output ref="@ui:label"/>
                    </xhtml:td>
                    <xhtml:td class="line">
                        <xforms:group>
                            <xforms:group ref="@ui:is-optional">
                                <xforms:input ref=".." incremental="true"
readonly="../@ui:is-selected = ''" class="input-text"/> 
                            </xforms:group>
 
                        </xforms:group>
                    </xhtml:td>
                </xhtml:tr>
            </xforms:repeat>
        </xhtml:table>
    </xhtml:body>
</xhtml:html>
 
-----Original Message-----
From: Erik Bruchez [[hidden email]] On Behalf Of Erik Bruchez
Sent: Monday, 16 October 2006 10:36 PM
To: [hidden email]
Subject: Re: [ops-users] Single Checkbox Production and Its Binding
 
Spenser Kao wrote:
  
I have been thinking of creating a **single** checkbox whose checked or 
unchecked value will decide whether a succeeding input box is enabled or 
not.
 
At [1], the use of XForms' select-choices-item approach is demonstrated 
to produce checkbox, but it appears to be meaningful only when multiple 
check boxes are expected, am I right on this perception?
    
 
No, you can use only one checkbox.
 
  
I tried the <xhtml:input type="checkbox"  ..> approach, and it produces 
what I wanted: a single checkbox, but I am still looking for the 
solution of binding it to the succeeding input box. Does anyone know how 
to do that?
    
 
You are in trouble if you try to mix HTML controls and XForms controls. 
Just use XForms:
 
<xforms:select>
   <xforms:label/>
   <xforms:item>
     <xforms:label>Select me!</xforms:label>
     <xforms:value>selected</xforms:value>
   </xforms:item>
</xforms:select>
 
-Erik
 
  
 



 
 
--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: [hidden email]
For general help: [hidden email]
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: Single Checkbox Production and Its Binding

Erik Bruchez
Administrator
In reply to this post by Adrian Baker
Adrian / Spenser,

This is correct. Readonly-ness on elements propagates to attributes, so
once your element becomes read-only, so becomes the checkbox, and you
are stuck.

It all depends whether you want many such checkboxes in your form, but
if you only have one (or just a few), you can bind it a node in another
instance, and use setvalue to set the ui:is-selected flag in your main
instance.

-Erik

Adrian Baker wrote:

> Hi Spenser,
>
> I would guess your readonly property on <driverslicence> is being
> propagated down to the attributes, which means the checkbox is becoming
> readonly as well as your input. From
> http://www.w3.org/TR/xforms/slice6.html#model-prop-readOnly:
>
>     "Inheritance Rules: If any ancestor node evaluates to true, this
> value is treated as true. Otherwise, the local value is used."
>
> You may need to change your instance data structure to get this to work.
>
> Adrian
>
> Spenser Kao wrote:
>> Thanks for tips from Adrian and Erik.
>>
>> But I found a weird symptom described below:
>> a) If the input field next to the checkbox IS bound to the checkbox
>> selection result, then the checkbox can have only one-way change: from
>> checked (ticketed) to unchecked (unticketed) and then the input field will
>> transit to readonly. But it's not reversible - can't change back to checked
>> from unchecked.
>> b) If commented out the statement of binding the input field next to the
>> checkbox selection result, the checkbox can be toggled.
>>
>> Anyone has a clue?
>>
>> But goal is till to be able to toggle the checkbox and reflect it onto the
>> attribute readonly of the next input field.
>>
>> Attached is my example, which is actually modified and trimmed down from
>> view.xhtml of XForms Control example as some may have noticed.
>>  
>> Regards,
>>  
>> Spenser
>> --- Start of example ---
>> <xhtml:html xmlns:xforms="http://www.w3.org/2002/xforms"
>>     xmlns:f="http://orbeon.org/oxf/xml/formatting"
>>     xmlns:xhtml="http://www.w3.org/1999/xhtml"
>>     xmlns:ev="http://www.w3.org/2001/xml-events"
>>     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>>     xmlns:xs="http://www.w3.org/2001/XMLSchema"
>>     xmlns:ui="http:/www.example.org/ui">
>>
>>     <xhtml:head>
>>         <xhtml:title>Person Details</xhtml:title>
>>         <xforms:model>
>>             <xforms:instance>
>>                 <person id="test">
>>                    <driverslicence ui:is-optional="true"
>> ui:is-selected="true" ui:label="Drivers Licence"/>                  
>> </person>  
>>             </xforms:instance>
>>             <xforms:bind nodeset=".">              
>>                 <!-- Dim the driverslicence if checkbox is not checked -->
>> xforms:bind nodeset="driverslicence" readonly="@ui:is-selected = ''"/>
>>             </xforms:bind>
>>         </xforms:model>
>>         <xhtml:style type="text/css">
>>             .table {
>>                 border-collapse: collapse;
>>                 border-spacing: 0;
>>             }
>>             .line {
>>                 padding-top: .2em;
>>                 padding-bottom: .2em;
>>             }
>>             .label {
>>                 text-align: right;
>>                 font-weight: bold;
>>                 color: #222;
>>                 padding-right: 1em;
>>             }  
>>             .input-text input { width: 15em; }            
>>             .xforms-repeat-selected-item-1 {
>>                 background: none;
>>             }
>>         </xhtml:style>
>>     </xhtml:head>
>>     <xhtml:body>
>>         <xhtml:table class="table">
>>             <xforms:repeat nodeset="*">
>>                 <xhtml:tr class="line">
>>                     <xhtml:td align="left" class="label line">
>>                    <xforms:group ref="@ui:is-optional">
>>
>>                         <xforms:select ref="../@ui:is-selected"
>> appearance="full">                    
>>                         <xforms:item>
>>                         <xforms:label/>
>>                         <xforms:value>true</xforms:value>
>>
>> </xforms:item>
>>                         </xforms:select>
>>
>>                    </xforms:group>
>>                     </xhtml:td>                
>>                     <xhtml:td align="left" class="label line">
>>                         <xforms:output ref="@ui:label"/>
>>                     </xhtml:td>
>>                     <xhtml:td class="line">
>>                         <xforms:group>
>>                             <xforms:group ref="@ui:is-optional">
>>                                 <xforms:input ref=".." incremental="true"
>> readonly="../@ui:is-selected = ''" class="input-text"/>
>>                             </xforms:group>
>>
>>                         </xforms:group>
>>                     </xhtml:td>
>>                 </xhtml:tr>
>>             </xforms:repeat>
>>         </xhtml:table>
>>     </xhtml:body>
>> </xhtml:html>
>>
>> -----Original Message-----
>> From: Erik Bruchez [mailto:[hidden email]] On Behalf Of Erik Bruchez
>> Sent: Monday, 16 October 2006 10:36 PM
>> To: [hidden email]
>> Subject: Re: [ops-users] Single Checkbox Production and Its Binding
>>
>> Spenser Kao wrote:
>>  
>>> I have been thinking of creating a **single** checkbox whose checked or
>>> unchecked value will decide whether a succeeding input box is enabled or
>>> not.
>>>
>>> At [1], the use of XForms' select-choices-item approach is demonstrated
>>> to produce checkbox, but it appears to be meaningful only when multiple
>>> check boxes are expected, am I right on this perception?
>>>    
>>
>> No, you can use only one checkbox.
>>
>>  
>>> I tried the <xhtml:input type="checkbox"  ..> approach, and it produces
>>> what I wanted: a single checkbox, but I am still looking for the
>>> solution of binding it to the succeeding input box. Does anyone know how
>>> to do that?
>>>    
>>
>> You are in trouble if you try to mix HTML controls and XForms controls.
>> Just use XForms:
>>
>> <xforms:select>
>>    <xforms:label/>
>>    <xforms:item>
>>      <xforms:label>Select me!</xforms:label>
>>      <xforms:value>selected</xforms:value>
>>    </xforms:item>
>> </xforms:select>
>>
>> -Erik
>>
>>  
>> ------------------------------------------------------------------------
>>
>>
>> --
>> 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

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



--
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: Single Checkbox Production and Its Binding

Spenser Kao

Thanks, Erik.

Spenser
-----Original Message-----
From: Erik Bruchez [mailto:[hidden email]] On Behalf Of Erik Bruchez
Sent: Tuesday, 17 October 2006 10:28 PM
To: [hidden email]
Subject: Re: [ops-users] Single Checkbox Production and Its Binding

Adrian / Spenser,

This is correct. Readonly-ness on elements propagates to attributes, so
once your element becomes read-only, so becomes the checkbox, and you
are stuck.

It all depends whether you want many such checkboxes in your form, but
if you only have one (or just a few), you can bind it a node in another
instance, and use setvalue to set the ui:is-selected flag in your main
instance.

-Erik

Adrian Baker wrote:

> Hi Spenser,
>
> I would guess your readonly property on <driverslicence> is being
> propagated down to the attributes, which means the checkbox is becoming
> readonly as well as your input. From
> http://www.w3.org/TR/xforms/slice6.html#model-prop-readOnly:
>
>     "Inheritance Rules: If any ancestor node evaluates to true, this
> value is treated as true. Otherwise, the local value is used."
>
> You may need to change your instance data structure to get this to work.
>
> Adrian
>
> Spenser Kao wrote:
>> Thanks for tips from Adrian and Erik.
>>
>> But I found a weird symptom described below:
>> a) If the input field next to the checkbox IS bound to the checkbox
>> selection result, then the checkbox can have only one-way change: from
>> checked (ticketed) to unchecked (unticketed) and then the input field
will
>> transit to readonly. But it's not reversible - can't change back to
checked
>> from unchecked.
>> b) If commented out the statement of binding the input field next to the
>> checkbox selection result, the checkbox can be toggled.
>>
>> Anyone has a clue?
>>
>> But goal is till to be able to toggle the checkbox and reflect it onto
the

>> attribute readonly of the next input field.
>>
>> Attached is my example, which is actually modified and trimmed down from
>> view.xhtml of XForms Control example as some may have noticed.
>>  
>> Regards,
>>  
>> Spenser
>> --- Start of example ---
>> <xhtml:html xmlns:xforms="http://www.w3.org/2002/xforms"
>>     xmlns:f="http://orbeon.org/oxf/xml/formatting"
>>     xmlns:xhtml="http://www.w3.org/1999/xhtml"
>>     xmlns:ev="http://www.w3.org/2001/xml-events"
>>     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>>     xmlns:xs="http://www.w3.org/2001/XMLSchema"
>>     xmlns:ui="http:/www.example.org/ui">
>>
>>     <xhtml:head>
>>         <xhtml:title>Person Details</xhtml:title>
>>         <xforms:model>
>>             <xforms:instance>
>>                 <person id="test">
>>                    <driverslicence ui:is-optional="true"
>> ui:is-selected="true" ui:label="Drivers Licence"/>                  
>> </person>  
>>             </xforms:instance>
>>             <xforms:bind nodeset=".">              
>>                 <!-- Dim the driverslicence if checkbox is not checked
-->

>> xforms:bind nodeset="driverslicence" readonly="@ui:is-selected = ''"/>
>>             </xforms:bind>
>>         </xforms:model>
>>         <xhtml:style type="text/css">
>>             .table {
>>                 border-collapse: collapse;
>>                 border-spacing: 0;
>>             }
>>             .line {
>>                 padding-top: .2em;
>>                 padding-bottom: .2em;
>>             }
>>             .label {
>>                 text-align: right;
>>                 font-weight: bold;
>>                 color: #222;
>>                 padding-right: 1em;
>>             }  
>>             .input-text input { width: 15em; }            
>>             .xforms-repeat-selected-item-1 {
>>                 background: none;
>>             }
>>         </xhtml:style>
>>     </xhtml:head>
>>     <xhtml:body>
>>         <xhtml:table class="table">
>>             <xforms:repeat nodeset="*">
>>                 <xhtml:tr class="line">
>>                     <xhtml:td align="left" class="label line">
>>                    <xforms:group ref="@ui:is-optional">
>>
>>                         <xforms:select ref="../@ui:is-selected"
>> appearance="full">                    
>>                         <xforms:item>
>>                         <xforms:label/>
>>                         <xforms:value>true</xforms:value>
>>
>> </xforms:item>
>>                         </xforms:select>
>>
>>                    </xforms:group>
>>                     </xhtml:td>                
>>                     <xhtml:td align="left" class="label line">
>>                         <xforms:output ref="@ui:label"/>
>>                     </xhtml:td>
>>                     <xhtml:td class="line">
>>                         <xforms:group>
>>                             <xforms:group ref="@ui:is-optional">
>>                                 <xforms:input ref=".." incremental="true"
>> readonly="../@ui:is-selected = ''" class="input-text"/>
>>                             </xforms:group>
>>
>>                         </xforms:group>
>>                     </xhtml:td>
>>                 </xhtml:tr>
>>             </xforms:repeat>
>>         </xhtml:table>
>>     </xhtml:body>
>> </xhtml:html>
>>
>> -----Original Message-----
>> From: Erik Bruchez [mailto:[hidden email]] On Behalf Of Erik Bruchez
>> Sent: Monday, 16 October 2006 10:36 PM
>> To: [hidden email]
>> Subject: Re: [ops-users] Single Checkbox Production and Its Binding
>>
>> Spenser Kao wrote:
>>  
>>> I have been thinking of creating a **single** checkbox whose checked or
>>> unchecked value will decide whether a succeeding input box is enabled or

>>> not.
>>>
>>> At [1], the use of XForms' select-choices-item approach is demonstrated
>>> to produce checkbox, but it appears to be meaningful only when multiple
>>> check boxes are expected, am I right on this perception?
>>>    
>>
>> No, you can use only one checkbox.
>>
>>  
>>> I tried the <xhtml:input type="checkbox"  ..> approach, and it produces
>>> what I wanted: a single checkbox, but I am still looking for the
>>> solution of binding it to the succeeding input box. Does anyone know how

>>> to do that?
>>>    
>>
>> You are in trouble if you try to mix HTML controls and XForms controls.
>> Just use XForms:
>>
>> <xforms:select>
>>    <xforms:label/>
>>    <xforms:item>
>>      <xforms:label>Select me!</xforms:label>
>>      <xforms:value>selected</xforms:value>
>>    </xforms:item>
>> </xforms:select>
>>
>> -Erik
>>
>>  
>> ------------------------------------------------------------------------
>>
>>
>> --
>> 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


--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/






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