Builder form questions

Hi,
I’m trying to configure form in builder - Builder.io: Drag and drop page builder and CMS

I did not find verbose manual how to handle some specific cases.
So, my questions:

  1. Field “Description”, it’s textarea and I marked it as Required field, but validator does not catch it and send form anyway, how to fix it?
  2. Field “Subject”, I wanna make default option as empty and check that user select something, so same require validation, could not reach it so far.
  3. How to handle form sending manually, what variable I should use for example to get all fields and do some additional checks and if it’s ok send form?
  4. Do you store data that I gonna send to email via this form? If so do you have some GDPR data protection? Encryption? Info might be sensitive

Thank you in advance!

Hi @Jediinspace!

It sounds like this could be fixed by just going ahead and writing your own validation. This can be done with Javascript in Builder. Attach a “on change” event to each input, and assign the event.target.value to a variable on State.

Then, add an “on submit” event to the form block. Prevent the default submit action, check the values of your variables to make sure they meet conditions, and then submit the form. Please note that I added an ID of “form” to the form block under Style > HTML Attributes so that I could trigger a submission with Javascript.

event.preventDefault();

let form = document.querySelector("#form");

state.formMessage ? form.submit() : state.formErrorMessage = 'Fill out each input to submit.';

^ The conditional here is just checking to see if the message in the form has any value.

To experiment with this and get hands-on, you can check out this Fiddle I made for manually submitting the form when custom validation is run.

We don’t store the data that is submitted to the form. We direct the data to the endpoint you specify but do not record that data. The server protocols to POST your data to your endpoint are encrypted and secure.

Thank you!

2 Likes