Hey All - brand new to java scripting in portal pages.
I'm trying to say if DOB Unknown is set to No, which is the default setting for this field, make Victims Date of Birth Required. If DOB unknown is set to Yes, don't make it required. I think I figured out the function (make changes to my fields from a snippet I found online
//New code DOB required
function makeDobRequired() {
debugger;
var KnowDob = $("#hd_victim_dob_unknown").val();
if (KnowDob == 0) //if dob is known
{
makeRequired('cra83_dateofbirth');
}
else if (KnowDob == 1) ////if dob is not known
{
makeNotRequired('cra83_dateofbirth');
}
}
but don't I have to call the function on the change event for the DOB unknown field? (#hd_victim_dob_unknown) > Field name.
How do I do that? also - does it matter where I put the function in my code? I put it in the beginning after mydocument).ready(function ()
. there is no other code in the script with these fields. The Victims Date of Birth is set to optional in dataverse.
thx