I want to display users around 10 clickable html "tags" (just text with some css that changes when clicked) on my form page. I want them to be able to select a maximum of 3 tags but no minimum requirement. I then want to take the sum of all clicks for each individual tag and do some calculations with them as a model method, like return the 3 most clicked tags.
It's important that my tags are on the form page and are submitted at the same time as the form. So I guess they have to be part of my form.
How would I go about doing this? An actual example would be tremendously helpful as I'm still very new to django and find the documentation (which I've looked at) somewhat hard to understand.
If you know the tags ahead of time, I'd recommend this setup:
Use a multiple select widget in your form (see the favorite_colors field in this Django widgets example)
Use Select2 or another JavaScript library that converts <select multiple> inputs into a tags-like UI
If you go that route, this widget from django-select2 looks like it should get you off to the races.
Related
I have a Django page using bootstrap and crispy forms that present a form. but the form is growing so much now that I probably have around 50 fields :( which are all within 1 massive HTML page. I'm pretty sure this is the wrong way to do it.
Is it possible to split the forms into say 5 pages, but still have a submit button to post all of the fields to the database?
For now, what I have done is to create tabs for each section of the giant form so it's easy than scrolling.
I'm thinking it's probably better to create different views for each section and then link the data somehow back using an IndexKey or something?
But i have no idea how i would configure the button to capture all the fields.
I know this is a rubbish question, but I don't really know what to search for?
Cheers
You can try to divide the form in bootstrap tabs like
Personal information --> form fields
Additional information --> form fields
Why don't you break the data input down into as many questions as you think is appropriate for each page? If you have 50 inputs, you could do 10 over 5 pages.
After submitting Page 1, return the POST data to Page 2 and store the data in hidden input fields. Repeat the process until Page 5 when you can POST all 50 to the server and insert the data into your Database.
A client is using Sitecore 9 - we are not Sitecore developers.
We've been asked a simple thing: add social media links to the Footer of their Sitecore site.
Its proving more difficult than expected.
I've added the links on other pages by editing the HTML directly via the WYSWIG editor.
But the Footer appears more restricted, only accepting the addition of templates like 'Link'.
The 'Link' template has an option to add an external URL but doesn't have an option to add an image.
The CMS looks like this:
Is there any way to add a link, with an image, via the CMS (without the need to write Sitecore code), so the page chnages from this:
to this:
If you dont want to write Sitecore code, maybe you should think about using frontend.
Find the views that holds the footer (probably Foundation/Footer.cshtml) or something like that.
-To easily find where it is, follow these steps
Go to a content page Presentation Details that has footer (probably any)
Go to Controls
Find the footer rendering in there
Click on it
Grab the Datasource's value
Go to the Datasource's path
There should be a field holding the value of the view.
Add some css class on the div that holds those items, and do your frontend stuff in there...
It is not a scalable solution, so I would highly recommend updating the Footer rendering by adding new fields and adapting the model/view. So that way a content editor could easily add a new value for each socials.
I am working on a Django project where I have about 7 pages all in order. Basically step 1 - 7. I would like for them to have some sort of navigation/progress bar above the content showing where they are in the pages and how much they have completed. The only thing I have found close to this is using Wizard Form. The only issue I run into with this is some pages do not have a form.
Page 1 = Pure text explaining information
Page 2 = Setup information
Page 3 = Form
Page 4 = Form
Page 5 = Information
Page 6 = Form
Page 7 = Completion/Thanks
Is it possible to still use the Wizard Form for this setup? Or is there a better method of doing what I am trying to accomplish?
I haven't used Wizard form, but they look decent. Here are a few things you can try:
The first way is complicated. From my experience, React libraries like Material-UI have support for a navigation bar, progress bar, and all sorts of transition effects. They are complicated to get started though, and I won't advise you to try this unless you had worked with React before.
The second way is sort of a cheat. If Wizard Form requires a form on every single page, you can use something like this to easily get by:
<form method="GET" action="">
<p>Put whatever you want here. Divs, text, whatever.</p>
</form>
As you might've noticed, it's a form with GET request with no actions and a submit button. In that sense, you can just treat this form as a regular division. If Wizard Forms requires just a form, you should get by with this trick.
I added a WebPartZone in the master page at the top pf the master page, this web part zone is a message bar that will display on all the pages but could be different on each page. Is it possible to have a web part zone in the template that is editable on each page? Or is a different way to do it?
Thanks
The short answer no. From the template engine prospective whatever editable in the master - is not editable in its children. All editable web parts/widgets editable on the master, are not editable in its children.
If you really want to have an editable text in the master and all its children, you probably need to clone and customize web part and form control it is based on. Or create you own web part.
P.S. You can have editable text in your page template so all page that use this template will have this editable text working.
If you can give more details on what kind thing you want to edit would be easier to provide an answer
P.P.S. You can have a work around but it will not be with editable text. You will have to edit message text at the form tab. Would that suits you?
You can add the webpart on your master, and use a macro to get the content, like {%CurrentDocument.GetValue("Message")%}, but you have to add a field to each page to store the message in.
Just throwing out one more option, if what you want to display changes from page type to page type, you can put a repeater on the master page, put a path of a period (current document), then use macros to set the page type to the current document class name and the transformation to currentdocument.classname+".mastermessage"
Using a macro, then add a transformation "mastermessage" to each page type it will encounter, then you can change the fields and format for each page type.
The client wants to be able to display, within a WFFM form, a list of Sitecore items (each item containing an image & some HTML text), each item next to a checkbox to allow the end user to pick one or more of these items.
Within the form designer, for this particular field, we would like to have an item selector which can be used by the content editor to pick and choose which items to display in the list.
Is this something feasible in WFFM? Are there examples of complex custom form fields that I could take a look at? Thanks!
I just found out that what I asked can be easily accomplished with the ChechboxList field type already provided by WFFM and some CSS styling to handle the content of each item.
Thanks and sorry for the post.