I've a doubt about the best practices related with Sitecore.
I will need to store a form information when the user presses Save button while he's still filling all the form before submit. Therefore, in case he goes to the website in the next day he will see the already filled information and he can submit.Because the form is long and splitted in four steps.
My doubt is more related with the best practices for Sitecore. Where should I store this information?
Should I create a table inside sitecore_core or other existing database and read from there? (If there's any way to do that with Sitecore libs)
Or should I create my own database, probably with just two tables, to store that information?
Thanks
You should create your own database and store the information there. It is no best practice to add tables to the Sitecore databases and storing this information inside one of the existing tables (ie Sitecore items) is also not the way to go.
So just go for the custom database.
If you are using user profiles and (xdb) analytics data and want to store the form data there anyway, that could also be an option (using a custom facet).
You should use WFFM for saving any form information. In case if you want to send/save any additional information then you add your custom save action. Like for example we save data from the contact us form and newsletter form to Eloqua or Marketo for other purposes using custom action.
Related
I have a simple app that gets user input and when a button is clicked, the input is saved as an entry on the database. I'm thinking of creating another app that not only displays the same information (think of view profile) but also simultaneously lets the user edit the text that is displayed in the text field.
I'm guessing the solution is to have the text-fields be auto-filled by pulling the data from the database, and allow overwriting the data once the submit button is clicked.
Typically read and edit views are separated for good reasons like avoiding accidental edits, allowing different levels of access, things like that. But this capability does exist in Django via forms. If you already have a Form built for submitting the data, you can provide a page with existing data pre-filled by initializing the Form instance with the data - in the docs they call this a bound form. See this example in the docs to get an idea of the mechanics.
I have been using Sitecore for a couple of years, and now looking to begin utilizing the Experience functionality found in Sitecore 8.
I have a view that will capture some user-provided data. How do I go about creating a "person" (don't know the correct Sitecore terminology) in the Analytics database from custom code.
You'll need to create a Contact. Contacts are a kind of profile store for xDb and allows you to store data about your visitors. A contact has a built in list of facets (email, phone number, name etc) that make up the contact record, but it's also possible to create your own facets.
If you are building a form to capture data you can use the new Tracker api to identify and update facets on a contact.
Here's some code to do this:
https://github.com/ianjohngraham/CoreBlimey.Utils/blob/master/CoreBlimey.Utils/xDB%20Contact%20Creator/CreateContact.aspx.cs
There's a walk through of how the code fits together here:
https://m.youtube.com/watch?v=Jq6TpMgUGAk
(Apologies for the sound quality)
Also if you are using the WFFM module in Sitecore 8 there are some new save actions that will create contacts and store xDB data.
You may want to spend time on the docs. Please refer here for articles and guides related to Personalization and Personas.
Most of the configuration can be specified in Experience Analytics within Sitecore and you can leverage Rules Engine to perform actions.
I am asp.net developer, currently switched to django. I am working on first app and have to maintain user data for some time and then send it to db unless user save button is clicked.
I want to know if django provides some kinds of alternatives to view states to store data temp within a webpage.
You didn't explain what "view states" are, but I guess you are looking for sessions.
Its unclear what you are actually looking for, because viewstates is just a way to preserve data.
If you need to store information for a particular user, but not commit it to a database, use sessions as Daniel suggested.
If you are create a multi-step form (also called a "wizard"), and need to preserve state between each step/form; use Form Wizard.
I have a form on my Django site (made with ModelForm) where users can submit some data to create new objects or modify existing objects. These data, however, need to be reviewed by our staff before they're committed to the database, sometimes in bulk at a later date.
I know I can use .save(commit=False) in my form-processing view to return an object that has not been saved to the database yet. But is there a way to collect all of these objects from multiple user submissions for later review? Ideally, I'd have an admin page that had a summary list of submissions with "Commit" or "Reject" buttons.
There's no one-step-out-of-the-box way to do this (at least not built in to Django), so you'll need to create the logic yourself, which should be pretty straightforward. Some approaches to consider:
Have a second model/table to which your form saves, then create a view for the review functionality which copies any approved records into the first table.
Avoid having second model/table and add a approved = BoolField(default=False) field to your model/table. Set objects to a custom manager which filters for default=True so the rest of your code will only see approved records by default. Have a second manager that does the opposite, i.e. filtering for unapproved records. Using this second manager, create a view for the review functionality which flips approved to True for anything that gets approved.
If, with the second approach above, you want use Django's admin site to do the review, create a proxy for your model which by default uses the second manager which filters for unapproved records. Then you can use the admin's inline display and editing functionality to see records at a glance and click approve as needed.
I have some Extranet users. Each user has a dedicated page/item, that is maintained by the Admins. The Admins should manually be able to "connect"/reference the current item to a single extranet user. I am think of something like using a valuelookup type or similar on the template.
But how could i accomblish this, as the users are stored in ASP.NET membership, and not directly in Sitecore, as they were in previous versions of Sitecore.
I think you've got the right idea. Either store the users's full name (Domain\UserName) in the item, or store the item ID in the user's profile. If you go the Profile route, be sure and update Sitecore's User template in the Core DB so that you can see the value in the user manager.
There's also a Sitecore table you could use called IDTable which is normally used for mapping Sitecore item IDs to external data. That might be your best solution since user Profiles can be annoying... will also be the most efficient in terms of finding/indexing this data. Look at the Sitecore examples of importing data to get an example using this API.