Can't check the checkbox...

2 replies · opened Aug 3, 2022

DdoyooneeAug 3, 2022

I fixed it.. but there's a question...
Because when I click the login submit button, it automatically submit the form, so I added to prevent the default action by adding the prevent default to loginForm, and then I changed the default prevent apply to loginSubmit button..

The question is "Do I have to add the default prevent?".

In the previous homepage, I didn't use the default prevent setting...

SSemicolon WebSTAFFAug 5, 2022

Hello,

Thanks for your Patience!

The Login Form does not have any JS Functionality at the moment. The Default Forms included with Canvas like the Contact Forms etc. include the AJAX Functionality. So you will need to use Custom Functionality in order to Prevent the Default Submit on the Form. You can consider wrapping the `` inside the .form-widget DIV. It will Validate the Form and then submit it via AJAX. You can use the following code for processing:
[ch_pre type="php"]<?php

$success = false;

if( $success == true ) {
echo '{ "alert": "success", "message": "Login" }';
} else {
echo '{ "alert": "error", "message": "Login Error!" }';
}
[/ch_pre]

Additionally, you can also add data-redirect="https://website.com/dashboard" to the .form-widget DIV. You can do the additional processing in the PHP for Login and set the Login Session.

Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard