Came back to this post cause now im trying to do something similiar i have a check box field and some text field i only want them to be required if the checkbox is selected, i did the above explained by Ray Borduin, but it always ask me to check the checkbox in order to continue, im using server side validation wich is the one i prefer cause it cant be shut down.
<?php
if (isset($_POST["KT_Custom1"])) {
$WAFV_Redirect = "";
$_SESSION['WAVT_depositar_716_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateRQ(((isset($_POST["Tipo_de_operacion"]))?$_POST["Banco_seleccionado"]:"") . "",false,2);
if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"depositar_716");
}
}
?>
form elemnts:
<label for="Tipo_de_operacion">Already made deposit:
<input type="checkbox" name="Tipo_de_operacion" id="Tipo_de_operacion" value="1" />
</label>
<label for="Banco_seleccionado">Type your deposit number:
<input type="text" name="Banco_seleccionado" id="Banco_seleccionado" value="" size="32" /></label>
And the show if
<?php
if (ValidatedField('depositar_716','depositar_716')) {
if ((strpos((",".ValidatedField("depositar_716","depositar_716").","), "," . "2" . ",") !== false || "2" == "")) {
if (!(false)) {
?>
Requiered field
<?php //WAFV_Conditional depositar.php depositar_716(2:)
}
}
}
?>
this checkbox internally is called "Tipo_de_operacion" the label out side is diffrent i want the user that if he is going to pay with a bank deposit he has to fill in a textfield with the deposit number, if he doesnt select the check box it should continue to insert the form to save the order for later payment.
I had no luck with the above technic to tell on server side validation that only if the checkbox is selected, what am i doing wrong here cause if i select the checkbox and fill the text field it works but thats not the point or goal to make this work,
Can we get a better example on how is it done with server side includes?
Thanks
Sades