Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help!! display = none not working

    Hi. this is my code for a form i am working on, i want it so that when "Non_Conformance_Type" = ID1
    that <tbody id="ID1" style="display: none;">
    </tbody>
    is displayed.
    Code:
     <script type="text/javascript">
    // <![CDATA[
    function display(obj,id1,id2,id3,id4,id5,id6,id7,id8) {
    txt = obj.options[obj.selectedIndex].value;
    document.getElementById(id1).style.display = 'none';
    document.getElementById(id2).style.display = 'none';
    document.getElementById(id3).style.display = 'none';
    document.getElementById(id4).style.display = 'none';
    document.getElementById(id5).style.display = 'none';
    document.getElementById(id6).style.display = 'none';
    document.getElementById(id7).style.display = 'none';
    document.getElementById(id8).style.display = 'none';
    if ( txt.match(id1) ) {
    document.getElementById(id1).style.display = 'block';
    }
    if ( txt.match(id2) ) {
    document.getElementById(id2).style.display = 'block';
    }
    if ( txt.match(id3) ) {
    document.getElementById(id2).style.display = 'block';
    }
    if ( txt.match(id4) ) {
    document.getElementById(id2).style.display = 'block';
    }
    if ( txt.match(id5) ) {
    document.getElementById(id2).style.display = 'block';
    }
    if ( txt.match(id6) ) {
    document.getElementById(id2).style.display = 'block';
    }
    if ( txt.match(id7) ) {
    document.getElementById(id2).style.display = 'block';
    }
    if ( txt.match(id8) ) {
    document.getElementById(id2).style.display = 'block';
    }
    }
    // ]]>
    </script>
    and...
    Code:
     <div id='Type_Non_Conformance_container'>
                      <select name='Type_Non_Conformance' id='Type_Non_Conformance' size='1' onchange="display(this,ID1,ID2,ID3,ID4,ID5,ID6,ID7,ID8)">
                         <option value='' %Type_Non_Conformance%></option>
                         <option value='ID1' %e89cf9a575493ea05184443c64bf031d%>Can Not Locate Product</option>
                         <option value='ID2' %4cf35d2927674904ba13019f94f16827%>Can Not Locate Email</option>
                         <option value='ID3' %8939f9a23e7bc218f93e8b223a364924%>Item Adjustment</option>
                         <option value='ID4' %27c35559235fb503e7fba0f1896cd4f2%>Missing Shipping Instructions</option>
                         <option value='ID5' %304931fb92d418057887a6b0727d83e7%>Partial Shippment Release</option>
                         <option value='ID6' %76bf955f6d4ce8498b71b82d16c656a9%,>Lost Sale</option>
                         <option value='ID7' %f7fa215ea76de432e1c83d283441c798%>Transfer/Order Did Not Ship</option>
                         <option value='ID8' %b6ed7f7429483a76bc42a5b26a1bbb3e%>Other</option>
                      </select>
                   </div>
    and...
    Code:
     <tbody id="ID1" style="display: none;">
                   <div id='heading_container'>
                     <div id='heading'>Can Not Locate Product</div>
                   </div>
                   <div id='Order_Transfer_Number_1_ID1_container'>
                      <input type='text' name='Order_Transfer_Number_1_ID1' id='Order_Transfer_Number_1_ID1' value='%Order_Transfer_Number_1_ID1%' size='20' class='sfm_textbox'/>
                   </div>
                   <div id='Order_Transfer_Number_2_ID1_container'>
                      <input type='text' name='Order_Transfer_Number_2_ID1' id='Order_Transfer_Number_2_ID1' value='%Order_Transfer_Number_2_ID1%' size='20' class='sfm_textbox'/>
                   </div>
                   <div id='label8_container'>
                      <label id='label8' for='Order_Transfer_Number_1_ID1' class='sfm_form_label'>Order/Transfer #</label>
                   </div>
                   <div id='label9_container'>
                      <label id='label9' for='Order_Transfer_Number_2_ID1' class='sfm_form_label'>-</label>
                   </div>
                   <div id='Taker_Number_ID1_container'>
                      <input type='text' name='Taker_Number_ID1' id='Taker_Number_ID1' onkeypress='return sfm_decimal_key_handler(this, event,&quot;.&quot;)' value='%Taker_Number_ID1%'/>
                   </div>
                   <div id='label7_container'>
                      <label id='label7' for='Taker_Number_ID1' class='sfm_form_label'>Taker #</label>
                   </div>
                   <div class='element_label' id='Order_Transfer_ID1_0_container'><input type='radio' name='Order_Transfer_ID1' id='Order_Transfer_ID1_radio_0' value='Order' %24304b44337785c961add086070b3981%/><label for='Order_Transfer_ID1_radio_0' class='element_label' id='Order_Transfer_ID1_radio_0_label'>Order</label></div>
                   <div class='element_label' id='Order_Transfer_ID1_1_container'><input type='radio' name='Order_Transfer_ID1' id='Order_Transfer_ID1_radio_1' value='Transfer' tabindex='1' %9b4d481b434f7128f666cbc9a19d7c7a%/><label for='Order_Transfer_ID1_radio_1' class='element_label' id='Order_Transfer_ID1_radio_1_label'>Transfer</label></div>
                   <div id='label10_container'>
                      <label id='label10' for='Product_Number_ID1' class='sfm_form_label'>Part #</label>
                   </div>
                   <div id='Picker_Name_Last_ID1_container'>
                      <input type='text' name='Picker_Name_Last_ID1' id='Picker_Name_Last_ID1' value='%Picker_Name_Last_ID1%' size='20' class='sfm_textbox'/>
                   </div>
                   <div id='Product_Number_ID1_container'>
                      <input type='text' name='Product_Number_ID1' id='Product_Number_ID1' value='%Product_Number_ID1%' size='20' class='sfm_textbox'/>
                   </div>
                   <div id='Picker_Name_First_ID1_container'>
                      <input type='text' name='Picker_Name_First_ID1' id='Picker_Name_First_ID1' value='%Picker_Name_First_ID1%' size='20' class='sfm_textbox'/>
                   </div>
                   <div id='label11_container'>
                      <label id='label11' for='Picker_Name_First_ID1' class='sfm_form_label'>Picker Name</label>
                   </div>
                   <div id='label12_container'>
                      <label id='label12' for='Picker_Name_First_ID1' class='sfm_form_label'>Last</label>
                   </div>
                   <div id='label13_container'>
                      <label id='label13' for='Picker_Name_First_ID1' class='sfm_form_label'>First</label>
                   </div>
                   <div id='label15_container'>
                      <label id='label15' for='Actions_ID1' class='sfm_form_label'>Actions To Be Taken</label>
                   </div>
                   <div id='Actions_ID1_container'><textarea name='Actions_ID1' id='Actions_ID1' cols='50' rows='8' class='sfm_textarea'>%Actions_ID1%</textarea></div>
                   <div id='label14_container'>
                      <label id='label14' for='Comments_ID1' class='sfm_form_label'>Comments</label>
                   </div>
                   <div id='Comments_ID1_container'><textarea name='Comments_ID1' id='Comments_ID1' cols='50' rows='8' class='sfm_textarea'>%Comments_ID1%</textarea></div>
                   <div class='element_label' id='Picker_Confirm_ID1_container'><input type='checkbox' name='Picker_Confirm_ID1' id='Picker_Confirm_ID1' value='Yes' %4e8c663c6495851abfac06ef48a73f85%/><label for='Picker_Confirm_ID1' class='element_label' id='Picker_Confirm_ID1_label'>Picker Confirm Action Is Done</label></div>
                   <div id='Screen_Clipping_ID1_container'>
                      <input type='file' name='Screen_Clipping_ID1' id='Screen_Clipping_ID1'/>
                   </div>
                   <div id='label16_container'>
                      <label id='label16' class='sfm_form_label'>Upload Any Screen Clippings</label>
                   </div>
                   </tbody>
    Please help, Thanks!

  • #2
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Add on

    one more thing is that by default it is still displayed. i want it so that when i open up the form, ID1 is not displayed untill i select it from the drop down.

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,020
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    You have illegal HTML.

    You can't have a <div> inside of a <tbody>.

    When you try to do that, the browser will just pull your <div> *OUTSIDE* of the <table>, and so anything you do to the <tbody> is completely ignored.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •