You are viewing limited content. For full access, please sign in.

Question

Question

I seem to have broken the 'jump to' feature of Required Field validation. Any suggestions?

asked on February 6, 2023

Exposition:  We have an 'Appointment Date' field that needs to show only certain dates (from an array) as available.  After a long, long time spent trying to make that work reliably and consistently with the built-in date field, we ended up creating a custom one out of a Single Field value.  One of the features of this custom calendar is that it re-validates that the date is still available upon submission (and that all works now - yay!).

 

Unfortunately, while I'm happy with the custom date picker's functionality, it seems to break something with Laserfiche validation of Required Fields.  Instead of jumping directly to the required field that was missed, it just jumps back to the beginning of the Form (which has several tabs and many fields).  That's going to be terribly confusing for most users. 

Anyone have any idea how I can re-enable the jump-to feature, manually or otherwise?  Barring that, any suggestions on how I can present the user with a conditional alert that tells the user why the Form took them back to the first page (e.g. "Validation failed - please review your form for missing Required Field values")?

0 0

Answer

SELECTED ANSWER
replied on March 24, 2023

I thought I should close the loop on this.  It turns out, the problem arose because I had renamed a variable without thinking about it too much, and had a calculated field (hidden by field rules) that referenced the original variable name.  Thus, when I tried to submit, it tried to 'show' me the field with the calculation error, but since it was hidden... I just went to the first page with no explanation.

It was a dumb mistake on my part in retrospect, but if anyone else has a similar issue I hope this is helpful!

0 0

Replies

replied on February 6, 2023

Hi Sean,

 

It sounds to me that there is some Required field in the first page that's not filled, and is hidden by custom javascript but not field rule, and when you submit, it tries to focus back to the first field that validates fail. Since the field is hidden, the users will get confused.

If that's not the case, can you provide the process(better with a simple test process) you used to create this issue and the steps? And what is the Forms version exactly?

1 0
replied on February 7, 2023 Show version history

Hi Zhiyong,

 

I don't have any fields hidden by javascript.  It does appear to be related to our ad hoc date/time validation on submit.  I could share the scripts we're using, but between the date/time creator and the population and validation processes, the code would be pretty extensive.  Is there an event listener and/or a function I could utilize to identify when required field validation occurs / fails?

0 0
replied on February 8, 2023

Hi Sean,

 

The classic form uses parsleyjs to validate the fields on form submit page, so basically you can write some code like

$(document).ready(function(){
$('input.Submit').on('click',function(){
var result=$('yourfield').parsley().validate();
//do something with this result
});
});

to check if the field passed validation or not and take other actions.

but you mentioned the date/time field is not using the built-in date/time field, so I cannot tell exactly if parsley will take effect on that field.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.