Send value to KoolMaskedTextBox from Javascript

André
I'm facing a problem when I need to indirectly fill a masked textbox that includes validation. I'm using KoolPHP version 8.2
This is how I create the textbox:
    ...
    $zip = $form->AddControl(new KoolMaskedTextBox("zip"));
    $zip->Mask = "########" ;
    $zip->SelectOnFocus = "CaretToBeginning";
    
    $zip_RFValidator = $form->AddControl(new KoolRequiredFieldValidator("zip_RFV"));
    $zip_RFValidator->TargetId = "zip";
    $zip_RFValidator->ErrorMessage = "ZIP code cannot be empty.";
    $zip_REValidator = $form->AddControl(new KoolRegularExpressionValidator("zip_REV"));
    $zip_REValidator->TargetId = "zip";
    $zip_REValidator->Expression = "/\d{8}/";
    $zip_REValidator->ErrorMessage = "ZIP code must have 8 digits.";
    ...

This code is inside a KoolForm and it's working fine. The problem is that I have a KoolGrid in the same page, where the user can select previously stored zip codes from the grid rows.
    ...
    $ctGrid->ClientSettings->ClientEvents["OnRowSelect"] = "Handle_OnRowSelect";
    $ctGrid->Process();
    ...

The API is configured using the following code:
            ...
            <?php echo $form->Render(); ?>
            <?php echo $koolajax->Render(); ?>
            <script type="text/javascript">
                function Handle_OnRowSelect(sender, args)
                {
                    var _row = args["Row"];
                    document.getElementById('code').value = _row.getDataItem()["code"];
                    document.getElementById('forum').value = _row.getDataItem()["forum"];
                    document.getElementById('obs').value = _row.getDataItem()["obs"];
                    document.getElementById('address').value = _row.getDataItem()["address"];
                    document.getElementById('number').value = _row.getDataItem()["number"];
                    document.getElementById('additional_info').value = _row.getDataItem()["additional_info"];
                    ...
                    document.getElementById('zip').value = _row.getDataItem()["zip"];
		}
            </script>
            <br>
            <?php echo $ctGrid->Render(); ?>

On screen everything is working just fine, when the user clicks on a grid row, the HTML elements on the form have their values updated with the database information from the clicked grid line, but when the submit button is clicked, the "$zip_RFValidator" is triggered even with the information present at the "zip" INPUT element. It seems to be ignoring the value sent by the Javascript code, It accepts just code that is actually typed on the "zip" INPUT control. Any idea about how to solve that? At the moment I have no clues.
Posted Jul 1, 2016 , edited Jul 1, 2016 Kool