Hi,
I have a notes field which is only required if my Status field = 'Reject' is it possible to set a field to required based on the value in another field?
Thanks for your help.
Please ignore the above I have figured it out from the example: js-validation-form
Thank-You
could you please give example of this?
i tried using the js-validation-form example but still stuck.
any help would be greatly appreciated
thank you.
2 fields contract_Worth and contract_ApprovedDate
condition would be placed within this field:
$col = array();
$col["title"] = "APPROVED";
$col["name"] = "contract_ApprovedDate";
$col["editable"] = true;
$col["editrules"] = array("required" => false, "date"=>true);
$col["condition"] = array('$row["contract_Worth"] > 10', "required" => true, "required" => false);
$cols[] = $col;
$grid["edit_options"]["beforeSubmit"] = "function(post,form){ return validate_form_once(post,form); }";
$grid["add_options"]["beforeSubmit"] = "function(post,form){ return validate_form_once(post,form); }";
$g->set_options($grid);
And in HTML script tag:
function validate_form_once(post,form)
{
var str=[];
if (post.contract_Worth > 10)
str[str.length] = "- Contract Approve Date is required";
str = str.join("<br>");
if (str.length == 0)
return [true,""];
else
return [false,"Check following errors:<br>"+str];
}
error message box appearce fine, but CANNOT SUBMIT after entering value into APPROVE field?
added above code AND
$col = array();
$col["title"] = "APPROVED";
$col["name"] = "contract_ApprovedDate";
$col["editable"] = true;
$col["editrules"] = array("required" => false, "date"=>true);
$col["condition"] = array('$row["contract_Worth"] > 10', "required" => true, "required" => false);
$cols[] = $col;
$col = array();
$col["title"] = "APPROVED";
$col["name"] = "contract_ApprovedDate";
$col["editable"] = true;
//$col["editrules"] = array("required" => false, "date"=>true);
//$col["condition"] = array('$row["contract_Worth"] > 10', "required" => true, "required" => false);
$cols[] = $col;
also tried commenting out editrules and condition
NOT WORKING.
please help!!!!!