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!
- Create a UI-only field on the same model as your email field
- Create a snippet that checks if the verify email UI-only field matches the email field
- Create a blank Template component to hold your alert text, copy the unique id
- Add your snippet like the one below.
- 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.$;<br />var borrowerModel = skuid.model.getModel('BorrowerAccount');<br />var borRow = borrowerModel.getFirstRow();<br />var borEmail = borrowerModel.getFieldValue(borRow,'Email__c');<br />var verEmail = borrowerModel.getFieldValue(borRow,'VerifyEmail');<br />if (verEmail == borEmail) {<br /> $("#template-unique-id").html(""); } else { $("#template-unique-id").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.$; var borrowerModel = skuid.model.getModel('BorrowerAccount'); var borRow = borrowerModel.getFirstRow(); var borEmail = borrowerModel.getFieldValue(borRow,'Email__c'); var verEmail = borrowerModel.getFieldValue(borRow,'VerifyEmail'); var borEmailTrim = $.trim(borEmail); var verEmailTrim = $.trim(verEmail); if (verEmailTrim == borEmailTrim) { $("#sk-32Rqgb-430").html(""); $('#nextPageButton').button('enable'); } else { $("#sk-32Rqgb-430").html("Email addresses do not match, please check again"); $('#nextPageButton').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.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.