Restrict values of autocomplete

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

Restrict values of autocomplete

SD
Hi,

I've a fr:autocomplete code that looks as shown below

<fr:autocomplete ref="instance('new')" dynamic-itemset="false" >
	<xforms:label>Enter a company name: </xforms:label>
	<xforms:itemset nodeset="instance('test')/company">
		<xforms:label ref="context()"/>
		<xforms:value ref="context()"/>
	</xforms:itemset>
</fr:autocomplete>

The test instance looks like this

<xforms:instance id="test">
	<results>
		<company>ABC</company>
                <company>DEF</company>
                <company>GHI</company>
                <company>GGG</company>
                <company>DKD</company>
        </result>
</xforms:instance>

Is there a way I can restrict the user not to enter anything more than these 5 values in the autocomplete field or the only way to do is to manually check the value entered against these 5 values on xforms-value-changed event.

Thanks
--SD
Reply | Threaded
Open this post in threaded view
|

Re: Restrict values of autocomplete

Alessandro  Vernet
Administrator
Hi SD,

What you are describing is the default behavior (at least in nightly
builds): if users type a value which isn't in the itemset, when the
field looses the focus, the value they typed will be blanked out, and
that value will never, at any point, end up in the instance.

Alex

On Mon, May 7, 2012 at 7:14 AM, SD <[hidden email]> wrote:

> Hi,
>
> I've a fr:autocomplete code that looks as shown below
>
>
>
> The test instance looks like this
>
>
>
> Is there a way I can restrict the user not to enter anything more than these
> 5 values in the autocomplete field or the only way to do is to manually
> check the value entered against these 5 values on xforms-value-changed
> event.
>
> Thanks
> --SD
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Restrict-values-of-autocomplete-tp4614913.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.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
> OW2 mailing lists service home page: http://www.ow2.org/wws
>


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

Re: Restrict values of autocomplete

SD
Thanks Alex,

I'm observing some weird behavior, I see sometimes the textbox still holds the value (thought the instance is cleared). I've attached sample code test.xhtml. Please try this

Try typing zapd and observe that the instance is null while the textbox still holds the value "zapd".

Thanks
--SD