Skip to content

Activate Form Builder for Registration Site(s) #76

Closed
ballaschk opened this issue Mar 4, 2020 · 12 comments · Fixed by #78 or #81
Closed

Activate Form Builder for Registration Site(s) #76

ballaschk opened this issue Mar 4, 2020 · 12 comments · Fixed by #78 or #81

Comments

@ballaschk
Copy link
Collaborator

Would it be possible to activate the built-in optional module "wagtailforms" for the creation of registration sites (e.g. Institute Retreat)?

https://docs.wagtail.io/en/v2.8/reference/contrib/forms/index.html

I then would use this to design a form that collects data of the applicants in a database of some sort, including free-text fields (Name, Abstract, etc), radio buttons, check boxes etc.

(Alternatively, I'd have to use an existing PHP-based submission form that was already used for several other occasions)

Best,
Martin

@donald
Copy link
Member

donald commented Mar 4, 2020

First test looks promising. Simple forms only, no upload of posters or something like that. The user has no option to view/change/correct the data at a later time, though.
Data entered can be downloaded from the admin page as csv. So mail is not really needed.
I'm not sure, if this can be made translatable (dual language)

@donald
Copy link
Member

donald commented Mar 7, 2020

Translation is a problem. If we enable translations for the form fields to support the form in both languages, so that the labels will be shown in the user language ("phone:", "Telefon:"), the data will be stored in different table columns ("phone_en" or "phone_de") according to the user language. The columns retrieved from the admin interface depend on the admin language, so you get either phone_en or phone_de in the CSV and won't see the entries of users with the other language).

Do we need translations of forms?

@ballaschk
Copy link
Collaborator Author

I don't think we need them so badly. For the time being, the "simple" solution should suffice.

Thanks a lot!

@donald
Copy link
Member

donald commented Mar 8, 2020

Merged into live website. Room for improvements, but maybe sufficient for now.

@ballaschk
Copy link
Collaborator Author

This seems to work really well! Thank you!

A little nitpick about something that really kills me – the alignment of the checkboxes is messed up, because the form inserts bullet points in ul-lists. Would it be possible to display the lists without the bullets?
Screenshot 2020-03-11 at 11 00 45

The button "Daten absenden" and error messages about mandatory fields, etc. are only in German, even though the default site language is English. Is there anything we can do about it (I'd prefer English-only if I had to decide). If not, that's ok ...

@donald
Copy link
Member

donald commented Mar 12, 2020

I think, the translations of "Submit Query" or "Please fill out these field." don't originate from the website, but from you browser with German UI? I only see English text.

The Website just sends <input type="submit"> and <input type="text" name="last-name-nachname" maxlength="255" required id="id_last-name-nachname">.

Which doesn't mean, that can't be fixed...

@donald donald reopened this Mar 12, 2020
@donald
Copy link
Member

donald commented Mar 12, 2020

I'll have a look at the bullet problem.

@donald
Copy link
Member

donald commented Mar 12, 2020

I've quickfixed the bullet problem with af4e5fe.

@ballaschk
Copy link
Collaborator Author

Much better :)

After a bit of googling I found this to get rid of the empty space that appeared where the bullets were:

ul{ margin: 0; margin-block-start: 0; margin-block-end: 0; margin-inline-start: 0; margin-inline-end: 0; padding-inline-start: 0; }
Is this too brutal?

@donald
Copy link
Member

donald commented Mar 12, 2020

Sorry, I didn't notice the white space myself. Correct, Firefox's wonderful developer tools revealed, that there was top and left margin inherited from another style sheet. I've set the margins 0 ( 9bc70ce ) as suggested in your quote. Looks better aligned to the other fields now.

@donald
Copy link
Member

donald commented Mar 13, 2020

It would be no problem, to specify the label of the Submit-Button. Either fixed "Submit" or translatable ("Submit"/"Absenden") according to the language selected.

Overriding the "Please fill out this field." is more complex and I see two options to do that:

  • Change the code to not use the required attribute, in which case the browser would post the form with empty fields and the servers validation would return it with inlined error messages. These inlined error messages would be translatable. I noticed, that the error messages are currently not styled, so some styling would need to be added to make them recognizable as error messages.

  • Use some Javascript magic to change the text ( https://jsfiddle.net/zpkKv/2/ ) . The referenced javascript example uses jQuery. So we'd need to add jQuery to that page, too

These two options make either the python code or the page code much more complex which by itself is a disadvantage in regard to maintainability. I'm not sure this is justified. Please decide.

@ballaschk
Copy link
Collaborator Author

Let's just have a translated Submit button, and the rest we can take care of when we are really bored at some point. Thanks a lot!

Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants