Hello everyone,
I am just starting with microsoft portals, i created a Entity Form and a Web Page realated to that Entity Form.
I added a submit action button to the Entity Form and i added my custom javascript to the Web Page.
The scenario is create new account records in CRM through the portal, and if the email address is empty, do not create the record.
To make the field required is not a solution for my future business logic.
I made this javascript trying to interrupt the submitting if the email address is empty:
$(document).ready(function() {
$('#InsertButton').on('click', function (e) {
e.preventDefault();
alert("button was clicked");
var emailAddress = $('#emailaddress1').val();
if(emailAddress === null || emailAddress === ""){
alert("Please provide an email");
}
alert(emailAddress);
})
});
By any reason, the submitting keeps going on, even if see the pop-up "Please provide an email"
I already tried to use:
return false
return
$("form").onsubmit(return false;)
I also tried the page validator: https://community.adxstudio.com/products/adxstudio-portals/documentation/configuration-guide/web-forms/web-form-steps/custom-javascript/ but is not longer working since version update.
And my last approach is using the preventDefault(); but still cannot cancel the submitting process and cannot override the onclick submit button functionality
Does someone know how could I override the functionality on click submit button?
Thanks very much in advance!
*This post is locked for comments