Hi AJ,
It's a good question and it relates to the timing of the view-render events. There's two ways to make it work:
- Use the view-render event of the last view to render - this can be inconsistent i think.
- Use the scene-render event - always works. See https://www.knack.com/developer-documentation/#page-render
So your scene-render might look something like:
$(document).on('knack-scene-render.scene_XXXX', function(event, scene) {
$("#view_1159 .kn-button").on("click", function() {
var requestedPto = $("#view_1159-field_5").val();
var availablePto = $("#view_2232-field_1").val();
if (requestedPto !== availablePto {
alert ("Don't match");
return false;
}
});
});
And then the next question to ask is whether you can handle this with page rules instead of code?
Brad