Forms problems

Hi all,

Every time I need to add a Form to a site, I seem to have problems. At first, it performs OK, and sends without any problems.

However, if I add fields, make other changes, or modify the modal ID or the Form ID, it often stops working, and I have to scrap it and start again.

Is anyone else having similar problems, or am I just making some error that screws up the functioning of the form?

I’m guessing that it’s me who is ‘flaky’ and not the App, but i’d be interested to hear from others on this, especially if there’s any kind of solution.

Any comments appreciated.

Hello again,

I have never had any problems with forms myself, but I have helped multiple Blocs users, who have been experienced some problems with forms on their websites. Most of the time, the source of a problem was the incorrect structuring of forms. For example, if you put DIV into DIV, then another column inside DIV, then DIV inside column, etc… the form will be corrupted and will not work.

As long as you keep the DIVs separate and only with one element(field, option, etc) inside, give clear IDs to each element, and place everything inside one form bric, you should not have any problems.

Cheers,
Eldar

Hi Eldar,

That’s very helpful, and also reassuring regarding the stability of the Blocs form!

I will go back through my Form(s) and check for these problems, and fix any I find.

Your assistance is very much appreciated.

Best wishes.

Hi, as Eldar says, I had exactly that problem the form seemed to send fine but never reached the recipient.
I found out with Norms assistance that I’d inadvertently dragged an input field out of its holding div, and mucked the whole thing up.

Hi @Eldar and @TrevReav,

Checked the first ‘problem’ form, and, yes, a Div inside a Div… Easy to fix when you know what you’re looking for!

No doubt the rest of my problems with the (too) many forms on the current site will prove to have the same solution.

Thanks for your help.

Hi all,
@Eldar, I’m still having problems with my forms! I fixed the problem to get each form working, then saved a ‘master’ bloc to the bloc library.

However, on adding the saved bloc to the page containing the original modal with form, the ‘random number’ applied to the form on its first creation stays with the bloc from the library, and a new ‘random number’ is applied (in addition to the first!) to the original form on the page.
See attached screenshots.

Ideally, I don’t want any of the ‘random numbers’ to show on the e-mail produced from the form, but despite removing all references to these that I can find, they still pop up … and now I have two of them.

My customer wants 4 similar forms on the one page, so I was hoping that I could get one working, save the bloc to the bloc library, add it back onto the same page, rename what I needed to, and then do the same for the next two… but I’m getting nowhere with this.

Should I be creating each form separately from the beginning to achieve what I need, or am I missing something here?

Any help appreciated.

@Eldar,
I can provide you with the .blocs file if it helps…

Each form needs its own unique ID and so do the form input fields.

So if you add two forms to a page for example the email input field would be called #email and #email2 etc.

I will often prefix the IDs with something related to what the form is for if I have multiple forms.

eg. contact_name, contact_email, submisison_name, submission_email

Hi @Malachiman,


As the attached screenshot, I have given each field an ID, and understand that each field in each form must be different, but the form ‘random number’ keeps popping up, and I can’t get rid of it. I presume there must be some way of removing it, as it makes the result in the e-mail look a bit untidy?

Also, saving the bloc with the modal and form in place to the bloc library seems to add to the problem rather than be the time-saver I had expected. With multiple forms, do you create each individually?

Thanks for your assistance.

If I can find a way of eliminating these ‘random numbers’, I’m beginning to think that I will be quicker just creating each form separately, if only to get this job done…

I had the whole thing sussed at the start (I thought), it really needs only one form, with four fields that were optional depending upon the user’s requirements, but my customer doesn’t want any ‘user confusion’… thus something like 14 separate forms site-wide…

The forms are accessed via a modal correct?

You could use one form, with all the fields required, then based on the button to activate the modal hide certain fields so the user doesn’t see them all. Only the right ones.

All fields would show up in the email you receive though.

Hi again,
Yes, all forms in modals.

That sounds like a hugely better, and much simpler idea!

Would you be kind enough to tell me step-by-step how I set which fields are hidden depending upon which trigger is used?

Not a problem if all fields show up on the e-mail!

Thanks.

One method I can think of is adding a custom attribute in the side bar for the button that activates the modal. it would be something like this to call a function.

onclick="myfunction ()"

Write a function for each form combination you needed. In that script you will just add a d-none class to the form field you want removed. That would look something like this…

function myfunction () {
  var element = document.getElementById("form-input-ID");
  element.classList.add("d-none");
}

You will also need to have a method to reset the form when the modal is closed.

You can probably simplify this right down by using data-attributes to minimise the code and just use one function.

Hi @Malachiman,

Thanks, but this is way beyond my capabilities! I’m a designer rather than coder, so the ‘no coding’ aspect is what I love most about Blocs. I can do some minimal coding in plain old HTML, but that’s a far as it goes!

As I have a deadline to meet with this job, I’m going to go ahead and create each form separately, one after the other.

Can you offer any means of getting completely rid of the ‘random number’ which appears on creation of a form? I do need to get that fixed (presuming it can be).

Thanks for your assistance meantime.

As I said before, each field needs a unique ID, if you have more than one form on the page, they cannot have the same IDs. Hence why Blocs adds the numbers so they are different.

Hi,

Sorry, I misunderstood before. So, to confirm, the number keeps appearing only because there is at least one instance of a duplicate field name that I’ve missed?

That being the case, I must be more careful when I set to work on the ‘final’ (I wish!) forms.

VERY many thanks for your assistance. Much appreciated.

Best wishes.

Yes that is correct. If you add a new form block the numbers will be different to duplicating a form.

For example.

If you have one form with an email field called email, and If you add another form from the form block the email field will be called email2.

If you duplicate the form you will get something like email_4243

Good luck, that many forms may cause confusion. A scripted solution would be much tidier. (and probably quicker).

Hi @Malachiman

Can’t disagree, scripting would be a lot better… but I’ll work to my limitations! Thanks for all your help and advice meantime.

Best wishes.

Hello @Hawkeye, just one question, if the forms are similar (and I think that what @Malachiman try to explain before) why you don’t have only one form, and in one of the fields you ask for a dropdown list or a selection field and you use the same form for 2, 3, 4, 5 topics.
Name, Email, etc. etc. are same for all 4 forms, and one field the costumer select the correct subject or whatever.

Just my 5 cents in this topic, if you allow…

Hi @Pealco,

I originally had a single form with the 4 fields which don’t apply for all users including placeholder text
“(For schools & libraries only)” .

I thought that was idiot-proof, but my customer wanted all possible ambiguity removed, so lots of forms! (i.e. he doesn’t want to see fields that don’t apply).

I know not everyone loves forms, and some people have difficulty with them, but I believe my original plan would have worked just as well…

“The customer is always right”? Not so sure…

Thanks anyway!

1 Like