Customize the Form Result Alerts (success/error) according to what you require. Set the data-alert-type to inline
or notify
to use the Default Alert Types. To use a Custom Alert Type (example), use data-alert-type="false"
. Example:
<div class="form-widget" data-alert-type="inline">
<div class="form-result"></div>
<form class="row" id="template-contactform" action="include/form.php" method="post">
<div class="form-process"></div>
...
</form>
</div>
You can use HTML/CSS or jQuery to Customize the Alerts. Canvas Form uses jQuery and CSS Classes to interact with the Document about the Form Status:
The CSS Classes are added on the Document <body>
:
<body class="template-contactform-ready">
<body class="template-contactform-processing">
<body class="template-contactform-complete">
<body class="template-contactform-complete template-contactform-success">
<body class="template-contactform-complete template-contactform-error">
Note: Make sure that there’s always a Unique ID assigned to the Form as the Form Classes above are assigned based on your Form IDs. Example:
<form class="row" id="template-contactform" action="include/form.php" method="post">
The Javascript Events are triggered only on Form Submission Success and Error only.
jQuery('#template-contactform').on( 'formSubmitSuccess', function(data){
// Your JS Codes here
console.log(data);
});
jQuery('#template-contactform').on( 'formSubmitError', function(data){
// Your JS Codes here
console.log(data);
});
Note: Always add the JS codes at the bottom of the Page after the js/functions.js
JS File Linking.
Last Modified: March 23, 2023