Answered
20 Jun 2016
in reply to
Missing user
Link to this post
Hi Julien,
If I understand correctly, you have a Sitefinity Text Box control, as well as a CRM Text Field control. From the sounds of it, you will have to use Javascript to validate the inputs on form submit. What you can do is in the TB control you can add a custom class, say "tbPassword". In a Javascript block, you can add code similar to this:
function ValidatePassword() {
var tb = document.getElementsByClassName("tbPassword");
var tf = findControl("CrmTextField_C001");
if (tb.innerText != tf.get_value())
{ return false; } else { return true; }
}
As you can see, we can reference TPC controls using findControl but need to use DOM manipulation to retrieve the TB value. Returning FALSE from the function will prevent form submissions. To make this work, on your submit button you should see a "OnClientClick" property in the Advanced window. Adding the name of the function here prefixed with "return" ( ie, return ValidatePassword() ) will call the function, verify the two field values, and then either return false (stop submission) or true (continue with submission).
To display a message to the user, you can throw in an "alert" step in the function while will display a pop-up to the user with whatever message you want.
Hope this helps, or at least gives you an idea on where to begin.
Thanks.
Matt Bayes