Back to Form Builder Support

gavinfostered11132
gavinfostered11132

When I submit the form I get the error "AJAX handler 'renderForm::onSubmit' was not found." How can I fix this?

Thanks

Renatio
Renatio

Hi,

do you insert renderForm component on cms page or somewhere else?

Do you use any alias in component properties?

gavinfostered11132
gavinfostered11132

Hi,

Thanks for the fast response! I put the component on a cms partial, I then use the partial on a static page using the Rain.Lab pages plugin. The form displays fine, just get the error when I hit submit.

Renatio
Renatio

Partials does not support ajax handlers for components.

Recommended solution is to use renderForm component in cms page.

The only way around, if you must use partial and RainLab.Pages is to move component configuration from partial:

[renderForm]
formCode = "form_builder_example"

to your layout.

So your layout configuration should look like this:

description = "Default layout"

[staticPage]

[renderForm]
formCode = "form_builder_example"
==
your html...

You must then specify formCode manually.

Last updated

gavinfostered11132
gavinfostered11132

Works perfectly! Thank you!

billyZduke
billyZduke

This also applies to pages as well as layouts. Got mine to work that way.

Troiscent
Troiscent

If you cannot put the form into partial, how do you customize the html output of the form ? I wouldn't hack the core by replacing the default.htm file of the component.

Renatio
Renatio

Hi,

as others mentioned you can use partial to place component, but you need to place configuration section in page or layout, so partial can access form component.

You can always override default component partial and plugin has a lot places which can be used to customize output.

Please first write us what you are trying to accomplish and than maybe we will find solution to your problem.

mike.last22290
mike.last22290

Hello, if I understood the previous comments I have implemented what you suggested but I am still getting the onSubmit error.

I have a partial contact-popup.htm, included in the footer partial. The form is appearing when I click a button, all fields are appearing just having an issue with the submission. The code I am using is below. any help appreciated

[renderForm contactForm]
formCode = "contact-form"

==

<button class="contact-popup-button" title="Show contact form"><i class="fa fa-envelope-o"></i></button>
<div class="contact-popup-wrapper">
    {% component 'contactForm' %}
</div>
Renatio
Renatio

Partials don't support components configuration.

Move

[renderForm contactForm]
formCode = "contact-form"
==

to CMS page or layout.

ranuchoudhary7056915
ranuchoudhary7056915

Renatio said:

Partials does not support ajax handlers for components.

Recommended solution is to use renderForm component in cms page.

The only way around, if you must use partial and RainLab.Pages is to move component configuration from partial:

   [renderForm]
   formCode = "form_builder_example"

to your layout.

So your layout configuration should look like this:

   description = "Default layout"

   [staticPage]

   [renderForm]
   formCode = "form_builder_example"
   ==
   your html...

You must then specify formCode manually.

Hi, Components can be use in partials or not?

As, I have used ajax handlers for component in partial, it is not working. It is showing "AJAX handler 'enquiryForm::onFormSubmit' was not found." I'm doing this using Magic Forms plugin.

Please give me a proper solution. If have to use renderForm component, then what I need to do? Can I use renderForm component in partials???

I'm waiting for your fast reply...

Thanks!

Last updated

LukeTowers
LukeTowers

AJAX handlers in partials are not supported, thus components with AJAX handlers in partials are not supported either: https://octobercms.com/docs/cms/partials#life-cycle-limitations

You can work around this by adding the component to every layout that you want to use it on, and then only rendering it in the partial instead. Since the component will then be present on the layout, you're able to use its AJAX handlers.

info25102
info25102

Hi, I'm trying to give backend users the opportunity to put forms on a page with a viewbag partial. They have to put in the formcode and then the form (via a partial) shows on the page (in the layout). The component [renderForm] is in the layout. Is it possible to only change the formCode property in the partial?

Thanks in advance for replying!

Last updated

beth.nicholas65790
beth.nicholas65790

I have the following inside a partial. The form_to_show is set on the page variable and passed into a partial. I have tried moving the renderForm config to default.htm but the formCode is set to "". Any help appreciated.

[renderForm] formCode = {{ data.form_to_show }}
==
{% if data.show_form == true %}
    <div class="new-form-styles">
        <div class="container">
            <div class="row">
                <div class="col">
                    {% component 'renderForm' %}
                </div> 
            </div> 
        </div> 
    </div> 
{% endif %}

1-14 of 14