help me on dis topic

Discussion in 'PHP' started by kool, Oct 7, 2009.

  1. #1
    hi,
    i have a combo box & 2 text box on my form for example:

    <form id="form1" name="form1" method="post" action="">

    <select name="payment_mode" id="payment_mode">
    <option value="cash">Cash</option>
    <option value="cheque">Cheque</option>
    <option value="credit card">Credit Card</option>
    </select>
    <input type="text" name="cheque no." id="cheque no." />
    <input type="text" name="bank_name" id="bank_name" />

    Now I want to hide those text box when the selected value from combo is cash.
    It works with the submit button but i dnt want to use submit button.
    How to i determine the selected value of list without submission of form.
     
    kool, Oct 7, 2009 IP
  2. AsHinE

    AsHinE Well-Known Member

    Messages:
    240
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    138
    #2
    I guess it is javascript question and not php.
     
    AsHinE, Oct 7, 2009 IP
  3. vetrivel

    vetrivel Peon

    Messages:
    147
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    <form id="form1" name="form1" method="post" action="">

    <select name="payment_mode" id="payment_mode" onchange="hide_for_cash(this.value);">
    <option value="cash">Cash</option>
    <option value="cheque">Cheque</option>
    <option value="credit card">Credit Card</option>
    </select>
    <div id="div_textbox">
    <input type="text" name="cheque no." id="cheque no." />
    <input type="text" name="bank_name" id="bank_name" />
    </div>
    <javascript>
    function hide_for_cash(value){
    if(value=='cash'){

    docuement.getElementById('div_textbox').style.display="none";
    }else{
    docuement.getElementById('div_textbox').style.display="inline";
    }



    }
    </javascript>
     
    vetrivel, Oct 7, 2009 IP