Sitecore WebFoms for Marketers module - sitecore

I want to ask you how it will be better to implement: using Sitecore WebForms for Marketers module or in standard .ascx sublayout.
So I need to implement huge form with dynamic dropdowns, date pickers, checkboxes, radiobuttons, etc. This form contains also dynamic adding new controls (see description in attachment above). So is it possible to create this form in Sitecore WebForms for Marketers module or it will be easier to write it as standard form in ascx.
This form will be saved to sitecore database.
Please answer if somebody have already done smth like this.
Thanks.

To my kowledge it isn't possible to do this out of the box with WFFM in Sitecore.
I guess the first question to ask is: do you or your customer want/need to be able to manage forms themselves without developer interaction?
If the answer to this question is yes, then you could try to implement this with WFFM, otherwise it may be easier to just implement as a normal sublayout.
EDIT
One other thing you could also do is to create a form, then use the 'export to ascx' function. You can look at the generated code to see how the data is written to the WFFM database - this way you can have your custom form functionality but still leverage the reporting functionality in the Sitecore client. If you have some decision tree-like logic for displaying the different fields you could probably drive this from Sitecore content items as well.

As per my knowledge you can create this form with the help of Web form for marketer but in this case you need to create some custom fields and update these fields as per your requirement.
To Create custom field create field under /sitecore/system/Modules/Web Forms for Marketers/Settings/Field Types/Custom location and in custom field define your created custom class and assembly.
You can update design by applying your custom css classes.
Class you can create under /sitecore/system/Modules/Web Forms for Marketers/Settings/Meta data/Css Classes location and apply class on specific control.

Related

Do I need to create forms.py for my forms in Django?

I'm about to create a form in my website made in Django with elements that have complex input types from different plugins (like calendar plugins). Also, I'll be using a Validator plugin which validates the input before submission.
My question is do I need to create forms.py and like model the form or can I just create the form manually? The former seems like a very hassle process. Which one is more efficient and recommended?
As #dmitryro said you can create your forms manually in the templates and then getting in the request. It's recommended to use the forms api provided by Django since it allows you to reuse, validate, and customize your forms.
As to whether or not it is a good practice that depends completely on you but if you are trying to scale an application I would recommend use the forms.
It is good to use Django's built in form.
If we use django's form then we only have to write python code and django will create corresponding html for it. And our code will be short and clean.

Sitecore Conditional Showing of Fields

So I am rather new to sitecore, and it's a topic that wasn't covered during my training. My questions is just to help point me to the correct term, or documentation on a method to do the following.
I have a definition item, with a ton of field groups, what I want to do is something like:
if Value of Field X is "yes" then collapse/hide Field X or Field Group X.
Does that make sense? Is it a validation rule? or some other kind of rules, is it a workflow I need to attach? Do you place it on just the field I want to hide, or the field that triggers the action?
I appreciate any guidance.
There is nothing out-of-the-box in Sitecore to achieve what you want but there is no reason you cannot create a composite custom field type to do this. The following articles will help you achieve this:
Creating a custom Sitecore Field
Getting to Know Sitecore: Custom Fields, Part 1
Create a new control, inheriting either from Droplist (if the comparison of the value is to be text based) or Droplink (for comparison of ID). You could add a parameter in the Source field of the control to specify what the values that trigger the hide should be.
The underlying control in the Content Editor is just a standard HTML select element. Add onchange events to the control and add your Javascript handler to hide the other controls. Since I could not find a way of adding additional custom css classes to the Sitecore controls, it would be best/easiest to hide all other controls in the same collapsible group after you control. This would mean you would need to group your controls better (or logically at least).
The Javascript will be something like this (the Content Editor uses the Prototype JS framework):
if ($(this).getValue() == 'no') {
// find the parent container of this control and then hide all the next siblings in the same group
$(this).up('.scEditorFieldMarker').nextSiblings('.scEditorFieldMarker').invoke('hide');
}
You can test this by running the above in the console, change out the keyword this with the id of your field, e.g. $('FIELD2292054').
What I am not sure about is how to trigger the hide on initial load, i.e. when someone returns to an existing item, it may be possible by adding to one of the pipelines, but would be better using a JS solution if possible. I'll have a think about this and get a proper code sample up over the next few days.
EDIT: You can add an event handler to sc:contenteditorupdated to handle the content editor being rel-oaded.
document.observe("sc:contenteditorupdated", myFunction);
I wrote up a blog post and put the code on GitHub if you are interested.
Not sure if you have come across Andy Uzick's this blog post.
He wisely talks about hiding fields in the Content Editor and has also created a Sitecore Module called Hide Field Template Extension which is hosted on the Sitecore Marketplace with the full source code to extend.
After reading through and trying the extension, I do feel that it will not completely resolve your issue (how you have described it in the question).
But it will give you:
A mid-term solution to hide a few unnecessary field that some content editors would not like to view.
Fields that are only required by administrators for admin purpose - to de-clutter these fields could be hidden.
Just one thing to bear in mind that it mentions in the requirements Sitecore 6.5 & 6.6. I have not tested it in Sitecore 7. If you are using Sitecore 7, which I think you are, one could modify the source code and make it work for Sitecore 7.
Have a look and share your findings.
Happy Sitecoring!

New to Django. How to incorporate "Add more" button in the form

I'm new to python and the Django framework. I am dealing with lots of forms in my application which is half way developed by the person working in this position earlier. I now need to change the form to incorporate the "Add additional details" button to my existing form.
Can anyone help me out with this? Do let me know in case you need any additional information from my end.
I suggest you read the Forms documentation: https://docs.djangoproject.com/en/dev/topics/forms/?from=olddocs
I don't really understand what you mean by "Add additional details". I'm assuming you want to just add additional items to your form.py of your app, be it model data? Again read the doc's they really helped me.
Is the form using an (inline) formset?
You need to use javascript or jQuery to insert a new set of fields into the web page. The formset management values need to be updated as well.
See this snippet or this plugin

sitecore: webforms for marketers, one form, two pages

I want to use single form for several pages like a block. Sitecore always creates a new form for a page.
How to share/reuse a form?
Depends on weather you are using WFFM 1 or 2 but it is quite similar.
Go to "Presentation/Layout details" for the item (page) that holds the form. You will find a rendering called "Form Interpreter" click this.
If you are using WFFM2 there is a "FormID" field that has your form selected. Just add a similar rendering to every page that you want the form to appear in and select the same form.
For WFFM1 there would be a parameter called "FormID" and a sitecore ID, copy this ID and the same renderings to the other pages including the parameters.
Good luck, Larre
There's an option to select a form to copy from. See paragraph 2.3.1 "Copying an Existing Form in the Page Editor" of this guide.
I had same issue with WFFM MVC version 8.1 (initial release)
our content editors wanted to use experience editor(page editor) and didn't want to change the datasource by going to presentation details and updating the datasource.
It doesn't need any coding
1- Copy /sitecore/layout/Renderings/Modules/Web Forms for Marketers/Mvc Form and give it a name "Custom Form"
2- Set the Data source location
3- Add the new rendering to place holder settings
/sitecore/layout/Placeholder Settings/content
my blog post
http://azadehkhojandi.blogspot.com.au/2016/01/how-to-reuse-web-forms-for-marketers.html

How customize fields in the Django admin interface

I have a model in my Django project with a member which is a char field. Basically data in this field will be entered as comma-separated values.
Without a long-winded explanation of what the overall goal of this is, basically rather than having the admin interface use a simple text field, I'd rather have have some custom HTML for the form so I can just use checkboxes and assemble the values of the checked boxes into a CSV string myself once the form is submitted.
Most of the django customization I was able to find on Google didn't answer my particular problem.
If I understand your question correctly I think you want to search for writing custom widgets. Perhaps start here: http://docs.djangoproject.com/en/dev/topics/forms/