1
0
-1

Hi there, 

Basically, the Add Entry screen is calling from the form grid and I want to do some validation before the data is added back onto parent form.

The "Please wait" message is shown when i put in the "return false" statement in the custom HTML.  My intention actually want to force the user to key in the completion date if the completion status is set to yes.  Anyhow failed to do it.   Would appreciate for any workarounds.  Thanks.

 

******* Sample script as below *******

<script>
$(document).ready(function(){
// to validate the completion date field whem the ADD button is clicked

$("#submit").click(function() {


if ( FormUtil.getValue("subTaskCompletionStatus") == "Yes" && FormUtil.getValue("subTaskCompletionDate") == "" ) {
alert("Please select completion date if the completion status is set to YES.")
return false;
}
});

});
</script>

 

 

 

 

 

 

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      Tried but failed too. The "Please wait" still prompting.  Please advise.  Thanks.

        CommentAdd your comment...
      1.  
        1
        0
        -1

        Hi, you can try calling $.unblockUI(); to see if it works.

        1. Wong Wah Man

          Tried already, but still cannot resolve. The "Please wait" still prompting. (refer my next answer)

        2. Anders

          I tried calling $.unblockUI() when the Please wait screen is showing and it works. Are you calling it from the correct place? You can use your browser developer tools to debug.

        3. Anders

          On a different note, do you really need to use custom javascript to do the validation? Why not use proper validators for the form fields?

        4. Wong Wah Man

          Only the status is set to Yes, and the completion date field is compulsory to fill in. That's why I am using custom HTML to check. I am not sure how to do it with default validators by Joget. Please advise. Thanks.

        5. Hugo

          You can try to create another section with exact same completion date field but compulsory. Then use https://dev.joget.org/community/display/KBv5/Show+and+Hide+Form+Sections to control based on "status" value on which section to show - the one with/without compulsory date field.

        CommentAdd your comment...