xpertbot / craft-wheelform

Craft CMS 4 Form with Database integration
MIT License
66 stars 32 forks source link

Front-end auto field creation #293

Closed kevadamson closed 1 year ago

kevadamson commented 1 year ago

Hi. Possible to "create" a field in the front-end without it being added in the admin?

For example, I'd like to add <input type="hidden" name="foobar" value="{{ currentUser.email }}"> but I just know my client will forget to create it when making form! Can it be auto added somehow based on the submission from the front-end, if that makes sense?

Actually not even auto-added - just submits the value to the entries but isn't then visible / editable in the form builder. Hope I'm making sense!

xpertbot commented 1 year ago

Hello, as a security measure, the forms don't save values if the field does not exist in the Admin area. However, there is a way to force this. You can create a small plugin helper like the one here. This plugin will listen to the beforeSave event, and you can add the new field and value to the form object for saving.

I hope that makes sense.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.