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
Hi @ctedesco3307,
as we are using a newer jQuery in Power Pages, could you follow that thread: https://stackoverflow.com/questions/6048022/jquery-attrdisabled-disabled-not-working-in-chrome
and change the .attr to .prop?
If the Id is not showing you can still use a class, easiest way is to use the chrome dev tools and copy the css selector. Test to change the .text() for example by executing jQuery inside the console.
@Lucas001 if you look at my image I am in preview. The ID of the submit button is not visible. I did all the other thigs you mentioned already.
Hi @ctedesco3307,
you will have to change all the ...your... jquery selectors, not only the one you mentioned.
TO get the Ids and in some cases the css path, use the page in preview, not inside the portal management app. That way you will easily get your selectors.
There were () missing in my code - I fixed it. In the future I propose using VS Code and pasting the code there - it mostly shows where the error occurs.
Hope that helps.
If you have any more problems, feel free to ask.
@Lucas001 Thanks for the reply. I'm not sure if I updated this correctly. Can you confirm I only need to put in the column name where you have
$(yourButtonDOBUnknown)
etc?
Also - how do I find the control name for the submit button? This is OOB Power Pages and it seems really hard to find the id's here on an inspect .... I don't know what the oob name is of the control.
Here is my mods to your code. Thx - also there does appear to be a missing bracket - where does it go? I put it on the end but it didn't like it
Hi @ctedesco3307,
as you said the DoB column should be set to optional as it depends on another condition and will become required.
I hope the code works as expected and I did not miss any bracket.
The implementation should work when you use a similar code to:
$(document).ready(function (){
//Executed synchronically from top to bottom
$(yourButtonDOBUnknown).on("click",function(){
//Code to make your Field required.
//Make it required by disabling your submit button.
$(yourSubmitButton).attr("disabled",true)
})
$(yourDateValue).on("change",function() {
//Check if input != null or != "" make buttom disabled false
($(yourDateValue).val() == "" || $(yourDateValue).val() == null) ? $(yourSubmitButton).attr("disabled",true) : $(yourSubmitButton).attr("disabled",true);
})
})
--------------------------------------------------------------------------------------
Hope that helps.
If the post solves your problem, please mark it as solution. If it helps, consider a thumbs up.