Skip to main content

Have a skuid page on a force.com Site, want to add a Verify Email Address field that forces someone to type in their email address twice and check if they match each other and if not throw an error. Would like to do this with a UI-only field, but am willing to create a field in database if that’s what it takes. 

Any ideas on how to make this happen? Thanks!

beat ya to it skuid community!

  1. Create a UI-only field on the same model as your email field
  2. Create a snippet that checks if the verify email UI-only field matches the email field
  3. Create a blank Template component to hold your alert text, copy the unique id
  4. Add your snippet like the one below.

  5. Create a model action that triggers when the Verify email field is updated, with an action of run a snippet


var params = arguments[0], $ = skuid&#46;$;<br />var borrowerModel = skuid&#46;model&#46;getModel('BorrowerAccount');<br />var borRow = borrowerModel&#46;getFirstRow();<br />var borEmail = borrowerModel&#46;getFieldValue(borRow,'Email__c');<br />var verEmail = borrowerModel&#46;getFieldValue(borRow,'VerifyEmail');<br />if (verEmail == borEmail) {<br />&nbsp; &nbsp; &nbsp;$("#template-unique-id")&#46;html(""); } else { $("#template-unique-id")&#46;html("Email addresses do not match, please check again"); }

Maybe two email address fields and then conditionally render a rich text field if they don’t match that says “email addresses do not match” and a save button that only renders if they do match. Yours is better, but I’m afraid of java script!


You can do it all with skuid, without javascript.

Instead of creating the snippet in Jack’s solution, create a ui-only formula field (maybe called (Verified") that returns a boolean with a formula like ({{Email__c}} == {{VerifyEmail}}).
Then create a template or rich text component with your warning message, and set up rendering conditions on it such that it only renders when both email fields are not null and Verified = true.


Hmm, you still might need some javascript after all, to force the formula to recalculate when the VerifyEmail field is changed?


Both good solutions! Not sure why I went the javascript route since it scares me too. But one issue that came up in testing, that may or may not be an issue with the other solutions here is that “test@test.com” is not the same as " test@test.com " - any extra spaces make them not come out as equal.

In JS, I could add a trim function, so that it takes out any space before or after and checks if they are equal after trimming. I wonder if that would automatically get trimmed if comparing two email fields, or an email field and a UI only field?

I also added the .button enable and disable stuff, which as pointed out above, is totally doable without javascript.

Anyway, here’s the updated code:


var params = argumentsu0], $ = skuid&#46;$; var borrowerModel = skuid&#46;model&#46;getModel('BorrowerAccount'); var borRow = borrowerModel&#46;getFirstRow(); var borEmail = borrowerModel&#46;getFieldValue(borRow,'Email__c'); var verEmail = borrowerModel&#46;getFieldValue(borRow,'VerifyEmail'); var borEmailTrim = $&#46;trim(borEmail); var verEmailTrim = $&#46;trim(verEmail); if (verEmailTrim == borEmailTrim) { $("#sk-32Rqgb-430")&#46;html(""); $('#nextPageButton')&#46;button('enable'); } else { $("#sk-32Rqgb-430")&#46;html("Email addresses do not match, please check again"); $('#nextPageButton')&#46;button('disable'); }<br />

True. I personally like the javascript version better. More flexibility. But finding ways to do things in Skuid without going to the dark side is always a fun puzzle.