W3C home > Mailing lists > Public > www-forms@w3.org > June 2005

RE: How do I make a select1 control visible based on selection of values in another select1 control

From: Mark Birbeck <mark.birbeck@x-port.net>
Date: Mon, 20 Jun 2005 12:41:42 +0100
Message-ID: <C4C44D9F-1379-4B07-8565-60F46B2A99EE@S009>
To: "'Anjali Abraham'" <anjalia@aztec.soft.net>, <www-forms@w3.org>, <www-forms-request@w3.org>
Hi Anjali,
 
You didn't say what processor you were using, but since you put my name on
your email, I guess it's formsPlayer!
 
The first thing with formsPlayer is that since there is no default
stylesheet, you will need to add a CSS rule to say that non-relevant
controls (disabled) should not be displayed:
 
  .disabled { display: none; }
 
For more info, see:
 
  <http://www.xforms-wiki.com/bin/view/Main/ProductFormsPlayerStyling>
 
 
Beyond that, there are some things in your code that I don't understand, but
I can't tell if they are just cut-and-paste errors:
 
 * you have '\' in front of '@' in your XPath expressions;
 
 * your test for relevance is the wrong way round (you should be testing for
"XXX_XX", according to your text);
 
 * are you using the instance() function to get to the rates? You will need
to;
 
 * your first XPath expression doesn't need to begin with 'root';
 
 * you have 'emenet2' in a number of places, and I guess it should be
'element2';
 
 * the default type for a node is xs:string, so you don't need to use a
xf:bind to set that.
 
Regards,
 
Mark
 
Mark Birbeck
CEO
x-port.net Ltd.

e: Mark.Birbeck@x-port.net
t: +44 (0) 20 7689 9232
w: http://www.formsPlayer.com/
b: http://internet-apps.blogspot.com/

Download our XForms processor from
http://www.formsPlayer.com/ 
 

  _____  

From: Anjali Abraham [mailto:anjalia@aztec.soft.net] 
Sent: 13 June 2005 11:12
To: www-forms@w3.org; www-forms-request@w3.org; Mark Birbeck
Subject: How do I make a select1 control visible based on selection of
values in another select1 control


Hi All,
            I have a scenario where there are 2 input xml's, as described
below:
 
1st XML:
        <root>
   -<elements id="1">
         <name>AAA</name> 
         <element1 attr1="aaa">0.02</ element1> 
         <element2 attr2="2">XXX_XX</ element2> 
            <element3>false</ element3> 
       </elements>
   -<elements id="4">
<name>ftaxex444</name> 
<element1 attr1="aaa">0.000</ element1> 
<element2 attr2="1">YYY_YY</ element2> 
<element3>1</ element3> 
      </elements>
</root>
 
2nd XML:
        -<Rates>
<rate id="1" name="STATE" >
<rate id="2" name="LUXURY">
</Rates>
 
Now I have in my UI one select1 control which will display element2's texts
like XXX_XX and YYY_YY from XML1 and below to this control I have another
select1 control which displays the element "rate"-attribute "name" values
like STATE and LUXURY from XML2 but this select1 control need to be visible
only when I choose XXX_XX and if I choose YYY_YY from 1st select1 control,
my 2nd select1 control shouldn't get visible.
 
Now for the same I have implemented it as :
 
In the Model, the bind is written as:
            <xforms:bind nodeset="root/elements/emenet2" type="xsd:string"
/>
            <xform:bind nodeset="Rates/rate" relevant="
root/elements/emenet2="YYY_YY" required="true()"/>
 
And in the Display, I have given the display as:
            <xforms:select1 ref=" root/elements/emenet2/\@attr2"
appearance="minimal">
                        <xforms:itemset model="QQQ" nodeset="Rates/rate ">
                                    <xforms:label ref="\@name"
style="width:100px;" />
                                    <xforms:value ref="\@id" />
                        </xforms:itemset>
            </xforms:select1>
 
But still for any selection to the 1st select1 control, the 2nd select1
control is always visible........ :-(
What else is the condition I need to add to make it invisible and is that
the bind condition and the display condition is right... since I am pretty
new to Xforms, so please anybody can help me out in this scenario.
 
                        
Regards,
Anjali
 
Received on Monday, 20 June 2005 11:42:26 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:01 GMT