Home > OS >  Value Given when tick box is checked :Undefined Array Key
Value Given when tick box is checked :Undefined Array Key

Time:12-19

When check box is selected, it copies value from customer to invoice party. So I am assuming that when check box selected. value is automatic. but it is saying undefined array key.

enter image description here

function EnableDisableTextBox(tickSame) {
    var shipper = document.getElementById("iP");
    var customer = document.getElementById("consignee").value;
        document.getElementById("iP").value=customer;   
    shipper.disabled = tickSame.checked ? true : false;
    if (shipper.enabled) {
    
        shipper.blur();

    }
    
}

CodePudding user response:

I hope you are submitting the form to the server side. Disabled inputs will not submit data when submitting the form. Instead you can use readonly attribute to make to non editable (Even you can make it look like disabled with css)

function EnableDisableTextBox(tickSame) {
    var shipper = document.getElementById("iP");
    var customer = document.getElementById("consignee").value;
        document.getElementById("iP").value=customer;   
    shipper.readonly= tickSame.checked ? true : false;
    if (shipper.readonly) {
    
        shipper.blur();

    }
    
}

  • Related