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

Discussion

Discussion

Auto-Trigger Review Task After Email Validation

posted on June 2, 2023

I am looking to implement a review step/task in a process. This step would be automatically triggered if the email field and the email field confirmation field do not match up. I used the hide submit button logic from the 'CSS, JavaScript, and Formula Examples' process in the Solution Marketplace.  I created a check box with a Yes or No value that I would like to use in the exclusive gateway that routes to the review step/task. I found some additional logic in the marketplace process that checks all boxes in the field.  What I am struggling with is trying to pick what box to check based off the confirmation pass/fail.  Is this something that can be done with JavaScript?

I've included the JS I am using so far. I appreciate any and all assistance that can be provided.

 

0 0
replied on June 5, 2023

As Blake mentioned, it would be helpful to understand your ultimate goal.

If your real goal is to ensure the two values match rather than having a manual review step, then you can do this using the built-in validation library.

You could try something like this instead

$(document).ready(function(){
  // custom validator for email confirmation
  window.Parsley.addValidator('emailconfirmation', {
    validateString: function(value, requirement, field) {
      var email = $('.email input').val().toLowerCase();
      var confirm = $('.emailconfirm input').val().toLowerCase();
      
      return (email == confirm || email == '' || confirm == '');
    },
    messages: {
      en: 'Email addresses do not match.',
    }
  });
  
  // assign validator to email confirmation field
  $('.emailconfirm input').attr('data-parsley-emailconfirmation','');
}

This code leverages the parsley validation library used in the classic form designer to create a custom validation rule and apply it to the "confirmation" input.

This will check if the two values match any time the confirmation field value changes, and if they do not match the error will prevent form submission.

Adjustments may be required if email entry is optional.

1 0
replied on June 5, 2023

Any reason you feel like you need that checkbox?

I've done similar just using a hidden single line field with a field formula, like:

=IF(email <> confirm_email,0,1)

Then, in the process map, you can have a path that's triggered if the single line field is 0 and another that's triggered if it's 1.

1 0
replied on June 5, 2023

I was using the checkbox as a way to do exactly what you referenced in your formula. I will give that a try. I am a firm believer in working smarter not harder and I know the checkbox is definitely working harder. 

0 0
replied on June 5, 2023

Why are you needing it to go to a review step? Should the email addresses always match?

1 0
replied on June 5, 2023

The email validation field is populated from a db lookup. The users requested this as the email addresses for the responsible party could possibly change in the database in the time between the initial submission and the final review that occurs at the end of the process. 

0 0
replied on June 6, 2023

Got it. That's different than the normal "retype your email address".

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

Sign in to reply to this post.