Form field names

5 replies · opened Nov 19, 2020

SsguvenNov 19, 2020

Hi,

I am trying to use the contact form. All the field ids and names have the prefix 'template-contactform-'. And on the server side, should I refer to these prefixed field names? The documentation is not very clear. Would you please clarify how do the forms work in this template?

SSemicolon WebSTAFFNov 19, 2020

Hello,

If you are adding Custom Fields to your Forms, you will need simply need to edit the HTML Codes and change the Input Name/ID according to the Field Name you want to display in the Form Email Response. That's it! You do not need to edit any Codes in the include/form.php File except adding your Email Settings. Our Form Processor Codes will detect all your Custom Fields and process them acordingly.

Consider following this Code Sample: http://docs.semicolonweb.com/docs/forms/fields/#docs-code-example . Make sure that all your Custom Fields have the same prefix as defined in your Form.

Suppose you want to add Age Field to your Form which has the prefix template-contactform- defined, then your HTML should look like this:
[ch_pre]
Age

[/ch_pre]

This will display as Age in your Form Response Email. If you set the name Attribute as template-contactform-your-age, then this will display as Your Age in your Form Response Email.

Hope this makes things clearer.

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

SsguvenNov 19, 2020

Hi,

I am not using the PHP file you mentioned. Rather, I am using Django framework.

Could you please let me know how the forms work? I am wondering about the role of AJAX, how the form is posted and how response is handled. I can update my server side Python codes accordingly.

Thanks,
Serhat

SSemicolon WebSTAFFNov 21, 2020

Hello,

The Form returns the response in JSON Format:
[ch_pre type="php"]echo '{ "alert": "success", "message": "Success Message!" }';[/ch_pre]

or this error message:
[ch_pre type="php"]echo '{ "alert": "error", "message": "Error Message!" }';[/ch_pre]

If the User submission is successful, show the success message and if the user submission has an error or there are any other issues, show the error message in the above format. This would make the default Form functionality included with Canvas work as expected.

Additionally, you can also consider using the .customjs Class on the .form-widget DIV to disable AJAX on the Forms to make any further tests.

Hope this Helps!

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

SsguvenNov 21, 2020

Hi,

Thank you for the clarification. Would you please let me know which JS is handling the responses? js/plugins.min.js OR js/functions.js?

Regards,
Serhat

SSemicolon WebSTAFFNov 21, 2020

Hello,

Specifically, the js/plugins.ajaxform.js File handles the Forms, which is then minified and combined in the js/plugins.min.js File. Consider checking the Javascript Guide: http://docs.semicolonweb.com/docs/getting-started/javascript/ for more details on how to use the JS Files with Canvas.

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