Hybrid View

  1. #1
    Sencha User
    Join Date
    Jan 2008
    Location
    Bangalore
    Posts
    26
    Vote Rating
    0
    arunpjohny is on a distinguished road

      0  

    Red face [SOLVED]Unchecked check box parameter is not submitted when a form is submitted

    [SOLVED]Unchecked check box parameter is not submitted when a form is submitted


    Hi all,

    I'm working on a form with checkbox, when I submitted the form, I found that the checkbox parameter is missing in the request parameter list when the checkbox is bot checked.

    Then I checked the form.getValues() method, this method also is not giving the parameter when the check box is not checked.

    When I went into the source code it is taking me to YAHOO.util.Connect.setForm(), there I found the following piece of code

    switch (oElement.type){
    ---------------
    ---------------
    case 'checkbox':
    if(oElement.checked){
    this._sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oValue) + '&';
    }
    break;
    ---------------------
    --------------------
    }

    Can any one tell me why the check box value is not attached to the formData if it is not checked? What is the logic behind it? And What should I do to get the value of a unchecked chechbox?

    Thank you
    Last edited by arunpjohny; 2 Jun 2008 at 7:50 PM. Reason: Issue resolved

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    56
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    This is how HTML works.

    You know the value. The value of a checkbox is whatever you set the value to when the checkbox was created. The information that changes is whether it is checked or unchecked. If it is unchecked the input is not submitted.

Thread Participants: 1