Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

ASP combo box problem

Options
  • 07-06-2006 12:14pm
    #1
    Registered Users Posts: 4,037 ✭✭✭


    I've got a combo box on an ASP page whose contents go into a table. A tick box has to be checked which disables it.
    The contents of the combo box (along with other details on the page from other comboxes, textareas etc.) are then entered into a table but I can't get the value in the combo box to go in to the table when it is disabled.
    I posted a similar problem here before but that was easy as it was a textarea's contents that was being transferred.
    In that case I just created a hidden textarea and transferred it to that.
    It's less easy with a combo box.


Comments

  • Closed Accounts Posts: 8,866 ✭✭✭Adam


    Best off posting a bit of code so we can see where your problem lies..there's no one definitive solution for these problems.


  • Registered Users Posts: 4,037 ✭✭✭lukin


    This is the combo box I want to take the values from
    <select name="cmbBugType" class="smalltextbox" onchange="checkRequest()">

    <% for i = 0 to ubound(vType)
    Response.Write("<option value='" & vType(i) & "'>" & vType(i) & "</option>")

    next
    %>

    </select>

    This is the textarea I want to transfer the contents of the combo box to
    <textarea type="hidden" name="dfBugType2" class="fulltextbox" value=""></textarea>

    This is the code I am using to transfer the contents of the combo box to the textarea:
    if (objForm.cmbBugType.disabled==true){
    document.getElementById("dfBugType2").value = document.getElementById("cmbBugType").value;
    }


  • Registered Users Posts: 683 ✭✭✭Gosh


    AFAIK the onChange event on a select box only fires when the value is changed not when it's disabled.

    Your event should be on the tickbox - use the onClick rather than onChange as IE only fires the event when the tickbox loses focus (onBlur). The onClick event for the tickbox should check the .checked property for true
    if(document.getElementById('checkboxname').checked) {
       it's clicked on process
    }else{
       it's click off process
    }
    


  • Registered Users Posts: 4,037 ✭✭✭lukin


    I think I've it sorted now: it turns out you can transfer the value in a combo box to an invisible text area.
    I didn't think it was doing it because I had the code to do it under the "onchange" event of the combo box. I clicked the button on the page that enters the data into the table without touching the combo box.
    Hence it doesn't transfer the data at all.
    Im just moved the code that does it to under the button that enters the data to the table.


Advertisement