Resetting select1 back to unselected state

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

Resetting select1 back to unselected state

eCubeH
What is the cleanest / simplest way to unselect a value from a select1? Once a value is selected, there seems no way to make it null again.
Reply | Threaded
Open this post in threaded view
|

Re: Resetting select1 back to unselected state

Dion Sole
On Aug 12, 3:15 pm, eCubeH <[hidden email]> wrote:
> What is the cleanest / simplest way to unselect a value from a select1? Once
> a value is selected, there seems no way to make it null again.
> --
> View this message in context:http://www.nabble.com/Resetting-select1-back-to-unselected-state-tp24...
> Sent from the Mozilla - XForms mailing list archive at Nabble.com.

Either put an item into the select1 with a value of "", and a label of
something like "---" or similar to suggest that it means "no value",
or put a trigger or such near the select1 with a setvalue to reset the
select1's binding to the empty string.
I use the first option in my forms since it takes less space and makes
more sense.
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: Resetting select1 back to unselected state

eCubeH
Thanks Dion. I did try all these options.

- I tried the "", but for some reason it did not work. I have placed the code below.
- I tried "<unselected>" or "<blank>", but that seems so ugly.
- I thought of the trigger but that seems like work. And I just thought, this is such a basic requirement, maybe there is something within the specs for it.

/eCH:SystemList/eCH:WeekDaysList/eCH:WeekDay --->

<WeekDaysList>
        <WeekDay code="0">Monday</WeekDay>
        <WeekDay code="1">Tuesday</WeekDay>
        <WeekDay code="2">Wednesday</WeekDay>
        <WeekDay code="3">Thursday</WeekDay>
        <WeekDay code="4">Friday</WeekDay>
        <WeekDay code="5">Saturday</WeekDay>
        <WeekDay code="6">Sunday</WeekDay>
</WeekDaysList>

### I tried adding <WeekDay code="7"></WeekDay> - but it didn't display. Tried both "" and " ".

<xforms:bind nodeset="/eCH:Report/eCH:Weekday" type="xs:string" />

<xforms:select1 appearance="minimal" ref="/eCH:Report/eCH:Weekday" tabindex="2">
        <xforms:label>Weekday:</xforms:label>
        <xforms:itemset model="mdlSystemList" nodeset="/eCH:SystemList/eCH:WeekDaysList/eCH:WeekDay">
                <xforms:label ref="."></xforms:label>
                <xforms:value ref="@code"></xforms:value>
        </xforms:itemset>
</xforms:select1>

Reply | Threaded
Open this post in threaded view
|

Re: Resetting select1 back to unselected state

Dion Sole
In reply to this post by Dion Sole
On Aug 12, 3:36 pm, eCubeH <[hidden email]> wrote:

> Thanks Dion. I did try all these options.
>
> - I tried the "", but for some reason it did not work. I have placed the
> code below.
> - I tried "<unselected>" or "<blank>", but that seems so ugly.
> - I thought of the trigger but that seems like work. And I just thought,
> this is such a basic requirement, maybe there is something within the specs
> for it.
>
> /eCH:SystemList/eCH:WeekDaysList/eCH:WeekDay --->
>
> <WeekDaysList>
>         <WeekDay code="0">Monday</WeekDay>
>         <WeekDay code="1">Tuesday</WeekDay>
>         <WeekDay code="2">Wednesday</WeekDay>
>         <WeekDay code="3">Thursday</WeekDay>
>         <WeekDay code="4">Friday</WeekDay>
>         <WeekDay code="5">Saturday</WeekDay>
>         <WeekDay code="6">Sunday</WeekDay>
> </WeekDaysList>
>
> ### I tried adding <WeekDay code="7"></WeekDay> - but it didn't display.
> Tried both "" and " ".
>
> <xforms:bind nodeset="/eCH:Report/eCH:Weekday" type="xs:string" />
>
> <xforms:select1 appearance="minimal" ref="/eCH:Report/eCH:Weekday"
> tabindex="2">
>         <xforms:label>Weekday:</xforms:label>
>         <xforms:itemset model="mdlSystemList"
> nodeset="/eCH:SystemList/eCH:WeekDaysList/eCH:WeekDay">
>                 <xforms:label ref="."></xforms:label>
>                 <xforms:value ref="@code"></xforms:value>
>         </xforms:itemset>
> </xforms:select1>

What you've got listed there is an empty label with a non-empty value.
What you need though is a non-empty label with an empty value, so
something like
<WeekDay code="">---</WeekDay> would work.

_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: Resetting select1 back to unselected state

eCubeH
OK, I get it now. I didn't know about the empty value.  

Thanks a ton!