How to maintain validated entry on multiple select list or single option dropdown
I have a multiple select list and a single select dropdown, both of which are populated from (different) recordsets, and their initial values come from another (same) recordset. Both of these fields have WA Validation ('required').
My issue is that I can't find a way to also have these fields hold any changes made if another field fails validation on submit - the list and dropdown return to the initial value. If I bind to the validated entries, I lose the initial value from the main recordset.
Multi-select list code:
<select name="services[]" size="25" multiple class="formListfield_Large" id="services" tabindex="81" title="To make multiple selections, hold down your control key and click on each item to highlight. To select all, or a block, hold down your shift key and click on the first and last items in the block." rel="<?php echo(WA_coalesce(array(WA_getSavedFormValue("CheckoutWizard_Cool_nzanlp","services"),(isset($_GET["invalid"])?ValidatedField("confirmcart","services"):"".$row_memberDetails['servicesOffered'] ."")))); ?>">
<?php
do {
?>
<option value="<?php echo $row_services['categoryLabel']?>"<?php if(isset($row_memberDetails["servicesOffered"]) && is_array(explode(",", $row_memberDetails["servicesOffered"]))) {
if(in_array($row_services['categoryLabel'], explode(",", $row_memberDetails["servicesOffered"]))) echo("selected=\"selected\"");
}
?>><?php echo $row_services['categoryLabel']?></option>
<?php
} while ($row_services = mysql_fetch_assoc($services));
$rows = mysql_num_rows($services);
if($rows > 0) {
mysql_data_seek($services, 0);
$row_services = mysql_fetch_assoc($services);
}
?>
</select>
Dropdown code:
<select class="formMenufield_Large" name="region" id="region" rel="<?php echo(WA_coalesce(array(WA_getSavedFormValue("CheckoutWizard_Cool_nzanlp","region"),(isset($_GET["invalid"])?ValidatedField("confirmmcart","region"):"")))); ?>" tabindex="39" title="Please enter a value" required="true">
<option value="" <?php if (!(strcmp("", $row_memberDetails['Region']))) {echo "selected=\"selected\"";} ?>>Please select region</option>
<?php
do {
?>
<option value="<?php echo $row_region['region']?>"<?php if (!(strcmp($row_region['region'], $row_memberDetails['Region']))) {echo "selected=\"selected\"";} ?>><?php echo $row_region['region']?></option>
<?php
} while ($row_region = mysql_fetch_assoc($region));
$rows = mysql_num_rows($region);
if($rows > 0) {
mysql_data_seek($region, 0);
$row_region = mysql_fetch_assoc($region);
}
?>
</select>
I would really appreciate your help on this one while I still have some hair left!
Cheers
Sylvia