如果满足特定条件,我想在硬编码下拉列表中隐藏单个值

时间:2017-11-18 07:51:24

标签: javascript

以下是我正在使用的下拉列表:

<Panel id="4" name="pnlUser" type="Stacked" caption="State Selection1" visibleinsteps="1,2,3,4,5,6,7,8,9" prepopulateinsteps="1" datadestination="" ext="labelWidth: 45,">
                  <Field name="StatePDF" caption="State" type="select" datatype="nstring" visibleinsteps="" editableinsteps="1,2" validationtype='combo' 
                  instruction="If your state does not appear in the list, state tax is not withheld or the form W-4 or other method is used." 
                  width="150" maxlength="20" instructionreadonly="false">
                    <Option name="StatePDF1" value="" label="Select..." />
                    <Option name="StatePDF2" value="AL" label="Alabama" />
                    <Option name="StatePDF3" value="AZ" label="Arizona" />
                    <Option name="StatePDF4" value="AR" label="Arkansas" />
                    <Option name="StatePDF5" value="CA" label="California" />
                    <Option name="StatePDF6" value="CT" label="Connecticut" />
                    <Option name="StatePDF34" value="CO" label="Colorado" />
                    <Option name="StatePDF7" value="DE" label="Delaware" />
                    <Option name="StatePDF8" value="DC" label="District of Columbia" />
                    <Option name="StatePDF9" value="GA" label="Georgia" />
                    <Option name="StatePDF10" value="HI" label="Hawaii" />
                    <Option name="StatePDF11" value="IL" label="Illinois" />
                    <Option name="StatePDF12" value="IN" label="Indiana" />
                    <Option name="StatePDF13" value="IA" label="Iowa" />
                    <Option name="StatePDF14" value="KS" label="Kansas" />
                    <Option name="StatePDF15" value="KY" label="Kentucky" />
                    <Option name="StatePDF16" value="LA" label="Louisiana" />
                    <Option name="StatePDF17" value="ME" label="Maine" />
                    <Option name="StatePDF18" value="MD" label="Maryland" />
                    <Option name="StatePDF19" value="MA" label="Massachusetts" />
                    <Option name="StatePDF20" value="MI" label="Michigan" />
                    <Option name="StatePDF21" value="MN" label="Minnesota" />
                    <Option name="StatePDF22" value="MS" label="Mississippi" />
                    <Option name="StatePDF23" value="MO" label="Missouri" />
                    <Option name="StatePDF24" value="NJ" label="New Jersey" />
                    <Option name="StatePDF25" value="NY" label="New York" />
                    <Option name="StatePDF26" value="NC" label="North Carolina" />
                    <Option name="StatePDF27" value="OH" label="Ohio" />
                    <Option name="StatePDF28" value="PA" label="Pennsylvania"/>
                    <Option name="StatePDF33" value="RI" label="Rhode Island"/>
                    <Option name="StatePDF29" value="VT" label="Vermont" />
                    <Option name="StatePDF30" value="VA" label="Virginia" />
                    <Option name="StatePDF31" value="WV" label="West Virginia" />
                    <Option name="StatePDF32" value="WI" label="Wisconsin" />
                    <Events>
                      <Event type="select" code="DisplayOpenButtons()"/>
                    </Events>

在上面的下拉列表中,我想要隐藏科罗拉多州&#39;下拉选项如果满足下面提到的功能条件(参见下面的功能):

    // Below is the function and condtion :

            <Function name="Hidedropdown">
            <Code>
            <![CDATA[
             function Hidedropdown()
             {
                var formObj = [*form*];
                var city1 =  formObj.F("City").getValue();
                alert(formObj.F("City").getValue());

                if (city1 == "SWC")
                {
                    formObj.F("StatePDF").show();

                }   
                else 
                {
                formObj.F("StatePDF").hide();   

                }                       
                alert(formObj.F("City").getValue());        
                         }
                        ]]>
                      </Code>
                    </Function>

如果City1 ==&#34; SWC&#34;然后&#39;科罗拉多&#39;应显示上面下拉列表中的选项  它应该被隐藏。

我想隐藏并仅使用javascript而不是jquery显示colorado选项。                 请告诉我简单的方法因为我已经尝试过使用动态下拉菜单                 但它在我们的项目中并不支持。

            Please help me. Thanks in advance.

0 个答案:

没有答案