advancedforms / advanced-forms

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

Custom HTML Output #20

Closed jamesfinley closed 6 years ago

jamesfinley commented 6 years ago

I would love to use something like this in a site that I am building, but it doesn't seem to allow for custom HTML. Optimally, I'd get a list of fields and be able to loop through and display accordingly. Instead, it appears, Advanced Forms includes 400kb of JavaScript and CSS into my page along with the form itself.

Am I missing something?

fabianlindfors commented 6 years ago

Hi!

I'm not quite sure I follow regarding the HTML. Do you want to display custom HTML in your form?

Regarding the JS and CSS it's mostly ACF including those files. Advanced Forms itself includes a small CSS file (400B) and no JS on the frontend. Although I wish ACF's includes were smaller there isn't much I can do. Note that having SCRIPT_DEBUG turned on in your wp-config.php increases the file sizes significantly.

Triloworld commented 6 years ago

There is option in acf_register_form (html_before_fields) to have additional html. This will be resolved by issue: #17

fabianlindfors commented 6 years ago

For adding extra html before or after the fields there exists two actions one could hook into: af/form/before_fields and af/form/after_fields

I'm a bit careful with adding more options to the shortcode/template tag as I don't want there to be to many. Are these filters enough for your use cases?

jamesfinley commented 6 years ago

Frankly, no. I believe this plugin is better for non-developers. For actual developers looking to allow a client to build forms with ACF, this isn’t good.

First, I expect I be able to 100% control the apparence and UX. To do that, optimally, I’d have a loop of fields. Display them however I desire. Then I’d have a method to submit the form that either emails or saves it to the database. This method should return validation errors or a success message. I then should be able to loop the errors and display them however I see fit.

This would allow me to accomplish whatever design my designer gives me.

For the non-developer, these types of plugins are good. Plug and play. No problem with that. It just doesn’t work for me.

fabianlindfors commented 6 years ago

Oh I see! I get were you are coming from, a form plugin offering total control would certainly be convenient and I could see myself using it in my day job. The goal with AF hasn't really been to create the most customizable form plugin but more a plugin which integrates nicely with ACF and the backend (something I always had trouble with when using Gravity Forms and the like).

My plugin could possibly be extended to offer greater control over form rendering but it would have to be explored for a later release as I have different priorities right now. Maybe some sort of hook for totally overriding rendering of a field would suffice?

It's a very interesting idea nonetheless and if you decide to create a plugin with greater output control I would love to hear about it!