<form action="/subaccount/editsubaccountcarveout/subaccount_id/<?=$this->view->subaccount->subaccountId;?>" name="frmaddcarveout" method="post" id="frmaddcarveout">
    <?php
        $dmsValuesToKeys = array_flip($this->view->dmsCustomerIds);
        $territoryValuesToKeys = array_flip($this->view->terrCountryIds);
        $dmsMasterValuesToKeys = array_flip($this->view->customerMasterMasterIds);
    ?>
        <table class="full-width" cellspacing="1" cellpadding="1">
        <tr>
            <td><b>DMS Master Carveouts</b></td>
            <td><b>DMS Carveouts</b></td>
            <td><b>Territory</b></td>
            <td><b>Continent</b></td>
        </tr>
        <tr>
            <td valign="top">
                <input type="hidden" name="hiddenlstDMS" id="hiddenlstDMS"/>
                <select name="lstDMSMaster[]" size="5" multiple class="multiple small">
                    <?php foreach ($this->view->customerMasterMasters as $customerMasterMaster) {
                        if ($customerMasterMaster["customer_master_master_id"] == 894) {
                            continue;
                        }
                        ?>
                        <option value="<?=$customerMasterMaster["customer_master_master_id"];?>" <?php if (isset($dmsMasterValuesToKeys[$customerMasterMaster["customer_master_master_id"]])) print "selected='select'";?>><?php echo $customerMasterMaster["customer_name"]?></option>
                    <?php } ?>
                </select><br />
                <input type="checkbox" onclick="SelectAllList(document.frmaddcarveout.elements['lstDMSMaster[]'], this.checked);" class="selectAll" /> Select/Clear All
            </td>                        
            <td valign="top">
                <select id="lstDMS" name="lstDMS[]" size="5" multiple class="multiple small">
                    <?php foreach ($this->view->customerMasters as $customerMaster) { ?>
                        <option value="<?php echo $customerMaster["customer_id"]?>" <?php if (isset($dmsValuesToKeys[$customerMaster["customer_id"]])) print "selected='select'";?>><?php echo $customerMaster["name"]?></option>
                    <?php } ?>
                </select><br />
                <input type="checkbox" onclick="SelectAllList(document.frmaddcarveout.elements['lstDMS[]'], this.checked);" class="selectAll" /> Select/Clear All
            </td>
            <td valign="top">
                <select name="lstTerritory[]" size="5" multiple class="multiple small">
                    <?php foreach ($this->view->territories as $territory) { ?>
                        <option value="<?php echo $territory["id"]?>" <?php if (isset($territoryValuesToKeys[$territory["id"]])) print "selected='select'";?>><?php echo $territory["name"]?></option>
                    <?php } ?>
                </select><br />
                <input type="checkbox" onclick="SelectAllList(document.frmaddcarveout.elements['lstTerritory[]'], this.checked);" class="selectAll" /> Select/Clear All
            </td>
            <td valign="top">
                <select name="lstContinents[]" size="6" multiple="multiple" class="multiple small">
                <option value="Africa">Africa</option>
                <option value="Antarctica">Antarctica</option>
                <option value="Asia">Asia</option>
                <option value="Europe">Europe</option>
                <option value="North America">North America</option>
                <option value="Oceania">Oceania</option>
                <option value="South America">South America</option>
                </select><br />
                <input type="checkbox" name="select_all" onclick="SelectAllList(document.frmaddcarveout.elements['lstContinents[]'], this.checked);"> Select/Clear All
            </td>
        </tr>                
    </table>
    <div class="panelButtons">
        <input class="btn btn-primary btn-sm" type="submit" value="Submit" onclick="return multipleSelectboxValueToCommaSeparatedString('lstDMS', 'hiddenlstDMS')">
        <input type="reset" value="Reset" class="btn btn-default btn-sm">
    </div>
</form>
<script>
$('#frmaddcarveout').submit(function() {
    //Put Validation
    return true;
});
</script>
