Split Sonata User Bundle registration form into stages - forms

I'm currently working on a user registration form for a site I'm working on. The site requires a lot of information about users up front, and I'd like to break it down into stages.
The first stage requires the user to put in an identifier in the form of an order number. I would then check the order number exists in the system before making them continue to fill in the rest of the fields. I'm not sure how to go about doing this.
What I've managed so far though is to override the underlying User, RegistrationController and RegistrationFormType and render out a customised view with the relevant form fields.
An overview of the process I'd like would be:
FORM: ask for order number
process form and check order number exists (if not go back to 1)
FORM: ask for user information
process user information and store
complete

Simplest way of doing it will be to override registration template, and hide all fields except those you wanna show in first.
And than add some js validation rules, - to show up parts of form based on values prefilled by user. In that case you do not need to rework Sonata registration form, but for user experience it will be the same.

Related

Needing to have a form in every instance of a content type that can be submitted once per node - Drupal 7

So here's the situation and I cannot figure out how to accomplish it.
I have a content type called "Alert". Each instance of this content type needs to have a webform (really just a submit button with hidden fields), that users click to acknowledge they have read and understand the alert. Ideally once submitted, the form should be replaced with a message along the lines of "You have marked this alert as read."
I do have a webform created (displaying as a block to be able to place within the variant page set up for the Alert type) and can get it to appear on each instance, but users can submit multiple times on each alert (submissions are set to unlimited as if i set it to 1 submission per user, the form does not render after the first submission on any alert). Additionally, once they click on one instance of the form, every additional instance will result in a message stating they have already submitted the form.
So I really have two issues. First, and most importanlty, allow a single submission per node (without the "already submitted" notice). Second, not required but would be nice, once it has been submitted for a specific node, the form no longer renders on that node for that particular user. Anyone have any ideas on the best way to accomplish these two aspects?
I'm running on Drupal 7.56, using the AT_Panels_Everywhere theme, Webform module Version: 7.x-4.15.
In drupal 7, with webform 7.x-4.0, you can enable webforms within a content type. To do so:
Go to Structure > Content Types
[Respective content type] > Edit
In the bottom left section, find the Webforms Tab and choose Enable webforms for this content type.
Based on your use case, I'd recommend enabling that and installing the node clone module. Then you can make one alert node, setup the webform, limited to one submission per user and allow content managers to clone content. That node can serve as a template.

How to show confirm box before submit form in moodle on course edit page?

I am using moodle 2.8
I wants to confirm user before edit course.
Basically I have a category name ex. 'Live' category
So when user move course into 'Live' category then want to show confirm box and if he click on yes then course will be update otherwise redirect to course edit page.
This will require changes to the Moodle core code (not usually a great idea, for ongoing maintenance) and would probably be a bit fiddly to implement - you would need to store all the submitted details somewhere in the confirmation form, then re-send them along with the confirmation.
It might be easier to make a small core code change to prevent the user from ever moving the course directly into the 'live' category (adjust the 'validation' function in the form submission), then have a separate admin page (within a local plugin, or maybe a block), that listed all the non-live courses and gave the option of moving them into the 'live' category (with the appropriate warnings / confirm action).

Using ninja forms, how can I persist field values across pages?

I have a form on the home page of quotedjobs.com that I would like to persist the field values of across pages.
For example: A user enters some values in fields, such as job title (textbox), job type (list) and job description (text field). Underneath that I ask users to register on the site, but they have the option to click a link to allow them to login if they are already members.
What I would like to be able to do, is to redirect users to another form that is a copy, but allows them to login instead of register, but keep hold of the values that they entered in the title, type and description form of the previous page so they aren't losing their work.
I have seen the ninja_forms_processing variable in the docs, but I'm not clear on how to use that.
TL;DR - You can't.
As it was slim pickings here, I sent an email over to support. Got this response:
Hello,
At this time this use case is not possible in Ninja Forms. The plugin is currently unable to transfer data from field to field or between forms.
I’m sorry that we do not have a better solution for you at this time.
Thank you,

Symfony2 - Showing a page for a user to confirm input form values

I have a long form that an user has to fill. After the user has clicked submit, I have to show a page with the information the user has filled in the form so that he can check that everything is correct before doing any further processing (i.e., he has to press another submit button or a back button if he detects an error).
Is there an easy way to do this? Is there a better way than creating a new form with hidden values equal to the values submitted in the previous form?
Would it be okay if I just store the information in a session variable and then process it if the user confirms?
You could skin that cat many ways, here's a couple of ideas:
Add a non-mapped confirm input (like a checkbox) to your form. On initial form render with no POST, hide the input. When you get a POST, show the checkbox input & some additional information (please review your data & check to confirm all is OK etc). Don't validate the form or save your data until the confirm input has been checked. You don't need to mess about with hidden fields, the one form will do the job for you.
Save the entity and give it a property e.g. isApproved, that way you can show the data easily & if the user needs to edit, re-use your form. When the user approves the information set isApproved to true. Don't perform any actions on any entities that have isApproved == false. Cons are you then have to manage an isApproved state for an entity.

facebook registration plugin : populating custom fields

I have an HTML form that uses the Facebook registration plugin. I have a couple of custom text fields (the kind that are included in the iFrame itself).
Whether user prefills the form using Facebook. or enters the data himself, I am able to store all values in my database without.
At the end of my post method, I redirect to load the same page. At this point, I would like to populate the fields from the data in my database. By which I mean, if the user logs off Facebook, on this page, he should still see the data that he has submitted to my database.
How do I set values for the fields (both custom and regular fields) in the registration form?
Should I say document.getElementById('field_name').value = "hello"?
Well it depends which technology you are using to generate the pages. That would be good to know. You most likely would have the JSP/ASP/PHP prepopulate those fields with from the data as it sends the HTML to the user.