advancedforms / advanced-forms

WordPress plugin to create forms using Advanced Custom Fields
75 stars 14 forks source link

Form display & Ajax render #67

Closed loicparent closed 5 years ago

loicparent commented 5 years ago

Hello Fabian,

Is there a way to keep the form fields (cleared) after sending the form ?

Aslo, is there a way to load all components of the form using a function or other ? (In fact, on an Ajax theme (for transitions). When I come to this page directly, all components are present but when I come from another page, the form is present and it works correctly but there is not javascript messages etc.).

Thanks for your help and have a nice day !

fabianlindfors commented 5 years ago

Hi!

I've been meaning to add a new argument for leaving fields cleared. For now it can be achieved by running AF()->submission = null; right before displaying the form.

I'm not sure I understand your second question. Using the advanced_form() function should load all components, including Javascript and CSS. Could you elaborate?

loicparent commented 5 years ago

Hello,

Thanks for your answer !

For the second question, I wanted to know if it was possible to load the sources (js etc.) I need for the form in case I'm on a site with ajax loading.

Have a nice day !

fabianlindfors commented 5 years ago

WordPress doesn't really have a built-in concept of enqueueing over AJAX. I imagine the simplest way is to enqueue all sources the regular way and then just load the form markup over AJAX. This might also take require some custom Javascript to set up ACF fields after the form has been loaded dynamically.

My plugin doesn't really support loading over AJAX so I unfortunately can't provide extensive support for that. Hope you understand!

loicparent commented 5 years ago

Hi,

Ok, I will try this and yes, I understand. One more thing, are you planning to allow ajax submission soon ?

Thanks !

fabianlindfors commented 5 years ago

It's certainly something I would like to add but there are other things prioritized right now!

loicparent commented 5 years ago

Ok thanks for your answers ! 😀