Dynamically filter dropdown list based on other dropdown value

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

Dynamically filter dropdown list based on other dropdown value

mbojja
Hi Alex - I have a service returning an xml below. The form must have 3 dropdowns (Countries - display all countries, States - display all states of the country selected, Cities - display all cities of the state selected ).  How do I achieve this using the xpath if the service do not take countries/states as request parameter? 

<json type="object">
    <success type="boolean">true</success>
    <message type="null"/>
    <countries type="array">
        <_ type="object">
            <country>Australia</country>
            <states type="array">
                <_ type="object">
                    <state>WA</state>
<cities type="array">
<_ type="object">
<city>Perth</city>
</_>
<_ type="object">
<city>Albany</city>
</_>
</cities>
                </_>
<_ type="object">
                    <state>Victoria</state>
<cities type="array">
<_ type="object">
<city>Melbourne</city>
</_>
<_ type="object">
<city>Geelong</city>
</_>
</cities>
                </_>
            </states>  
        </_>
<_ type="object">
            <country>USA</country>
            <states type="array">
                <_ type="object">
                    <state>California</state>
<cities type="array">
<_ type="object">
<city>San Francisco</city>
</_>
<_ type="object">
<city>Los Angeles</city>
</_>
</cities>
                </_>
<_ type="object">
                    <state>Texas</state>
<cities type="array">
<_ type="object">
<city>Dallas</city>
</_>
<_ type="object">
<city>Houston</city>
</_>
</cities>
                </_>
            </states>  
        </_>
    </countries>
</json>

Thanks

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/b343266e-80e3-464d-b80c-9ff9a183b343%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically filter dropdown list based on other dropdown value

Alessandro  Vernet
Administrator
Hi Manish,

I've created a form that shows how you can do this (see `form.xml` linked
below). And you can see what this looks like in the video linked below.

(Updating the list of possible values in dropdowns requires an Ajax request
to the server, so one downside of updating dropdowns this way is that if
users open the State dropdown very quickly after changing their selected
Country, they will still see the list of states of the previously selected
country.)

form.xml <http://discuss.orbeon.com/file/t119778/form.xml>  
cascading-dropdowns.mp4
<http://discuss.orbeon.com/file/t119778/cascading-dropdowns.mp4>  

You'll let me know if this works for you,

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1582668069512-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically filter dropdown list based on other dropdown value

mbojja
Thanks Alex - the form looks different to what I have asked.


On Wednesday, February 26, 2020 at 6:01:04 AM UTC+8, Alessandro Vernet wrote:
Hi Manish,

I've created a form that shows how you can do this (see `form.xml` linked
below). And you can see what this looks like in the video linked below.

(Updating the list of possible values in dropdowns requires an Ajax request
to the server, so one downside of updating dropdowns this way is that if
users open the State dropdown very quickly after changing their selected
Country, they will still see the list of states of the previously selected
country.)

form.xml <<a href="http://discuss.orbeon.com/file/t119778/form.xml" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdiscuss.orbeon.com%2Ffile%2Ft119778%2Fform.xml\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH-kQq86nRhxmeAHNseu9ucWhj7QQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdiscuss.orbeon.com%2Ffile%2Ft119778%2Fform.xml\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH-kQq86nRhxmeAHNseu9ucWhj7QQ&#39;;return true;">http://discuss.orbeon.com/file/t119778/form.xml>  
cascading-dropdowns.mp4
<<a href="http://discuss.orbeon.com/file/t119778/cascading-dropdowns.mp4" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdiscuss.orbeon.com%2Ffile%2Ft119778%2Fcascading-dropdowns.mp4\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEHieMfYbLKXgjmKDz_micQ9ZvNxw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdiscuss.orbeon.com%2Ffile%2Ft119778%2Fcascading-dropdowns.mp4\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEHieMfYbLKXgjmKDz_micQ9ZvNxw&#39;;return true;">http://discuss.orbeon.com/file/t119778/cascading-dropdowns.mp4>  

You'll let me know if this works for you,

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: <a href="http://discuss.orbeon.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdiscuss.orbeon.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF5V5zfD-87RVoalaG4cqO_RzdDcA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdiscuss.orbeon.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF5V5zfD-87RVoalaG4cqO_RzdDcA&#39;;return true;">http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/c7e4ce6a-6025-44d0-910f-0c9eda934425%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically filter dropdown list based on other dropdown value

Alessandro  Vernet
Administrator
Hi Manish, you're welcome, and of course in the case the form I attached is
materially different, in the sense that you can't infer from it how to do
what you need, you'll just let me know in what way that is.

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1585261810183-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically filter dropdown list based on other dropdown value

mbojja
Hi Alex - Please see the original question below.

Hi Alex - I have a service returning an xml below. The form must have 3 dropdowns (Countries - display all countries, States - display all states of the country selected, Cities - display all cities of the state selected ).  How do I achieve this using the xpath if the service do not take countries/states as request parameter? 

<json type="object">
    <success type="boolean">true</success>
    <message type="null"/>
    <countries type="array">
        <_ type="object">
            <country>Australia</country>
            <states type="array">
                <_ type="object">
                    <state>WA</state>
<cities type="array">
<_ type="object">
<city>Perth</city>
</_>
<_ type="object">
<city>Albany</city>
</_>
</cities>
                </_>
<_ type="object">
                    <state>Victoria</state>
<cities type="array">
<_ type="object">
<city>Melbourne</city>
</_>
<_ type="object">
<city>Geelong</city>
</_>
</cities>
                </_>
            </states>  
        </_>
<_ type="object">
            <country>USA</country>
            <states type="array">
                <_ type="object">
                    <state>California</state>
<cities type="array">
<_ type="object">
<city>San Francisco</city>
</_>
<_ type="object">
<city>Los Angeles</city>
</_>
</cities>
                </_>
<_ type="object">
                    <state>Texas</state>
<cities type="array">
<_ type="object">
<city>Dallas</city>
</_>
<_ type="object">
<city>Houston</city>
</_>
</cities>
                </_>
            </states>  
        </_>
    </countries>
</json>

Thanks

On Friday, March 27, 2020 at 6:30:14 AM UTC+8, Alessandro Vernet wrote:
Hi Manish, you're welcome, and of course in the case the form I attached is
materially different, in the sense that you can't infer from it how to do
what you need, you'll just let me know in what way that is.

‑Alex

And the form here <http://discuss.orbeon.com/file/t119778/form.xml> has a different solution. Could you please update the solution for the question above. Thanks :)


-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: <a href="http://discuss.orbeon.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdiscuss.orbeon.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF5V5zfD-87RVoalaG4cqO_RzdDcA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdiscuss.orbeon.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF5V5zfD-87RVoalaG4cqO_RzdDcA&#39;;return true;">http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/190c4b6f-17a0-4495-9d39-83a78ff8ba1d%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically filter dropdown list based on other dropdown value

Alessandro  Vernet
Administrator
Hi Manish,

I see: I had attached the wrong source! He is the correct one, and you'll
let me know if this works for you.

form.xml <http://discuss.orbeon.com/file/t119778/form.xml>  

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1585335585867-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically filter dropdown list based on other dropdown value

Alessandro  Vernet
Administrator
Hi Manish, did you get a chance to try the "correct" ;) form attached Tony
previous message? Does it do what you were looking for with chained
dropdowns?

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1585934486167-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet