I want to use ASP.NET MVC to create a registration page.
The registration page will have a single view and it will have multiple forms. The user can use "back" and "continue" buttons to go to a form (partial form).
First step:
On Form1, the user will enter his name, email and click "continue" which should do a postback and validate the form inputs. If form is valid, display form 2.
Second Step:
The user will add his company address and then click on "Done".
How can I create such a form in multiple steps?
I want to use ASP.NET MVC to create a registration page. The registration page will has a single URL and it will have many forms. The user can use "back" and "continue" buttons to go to a form (partial form).
FIRST STEP: The user will enter his name, email, .. in Form1 Then he should click on "continue"--> Postback and validation of inputs. SECONED STEP: If Form1 is OK and the user has clicked the "continue"-button the second form (Form2) will appear. The user will add his company address and then click on "Done".
How can I create such a form in multiple steps?
Related
Scenario is : User has many comments.
Now I have to create a form in four steps to create user and his comments.
In step 1, 2, 3 I will ask from the user to fill his profile details like first_name, email, address etc. and in the forth step there will be a button called as "ADD Comment"
When the user will click on ADD comment button a popup will open with the "Save comment" button in that he will fill up the comment title, text etc and after filling all the information he will click on "Save Comment" button and then popup will disappear and on the same page that comment will append so row by row all added comments will be shown in the table format. Also every row will have the delete icon to delete a comment.
Now this step four is the final step that will have the "Submit" button and when user will click on that all information should be save.
How can I accomplish this task ? What is the best way to approach this ?
The ideas those I have like:
1) When user will click on next button on the third step then I can create a user and that object I can pass in the forth step to create his comments.
2) or Create both the user and comments when he click on Submit button using accepted_nested_attribute.
3) Create the comment in the database when user will click on "Save comment"
Please suggest a fully better solutions.
Thanks
Anand
You could create a StepsController with all your actions or I would suggest that you look at the wicked gem for creating easy multistep forms.
I have created a scaffold called TRADER and gave it the entries
fname:string
lname:string
twitteruser:string
email:string
I want the form visible on the index page for the app user to submit their entry. Upon submission, I want a pop up box to appear saying " Thank you for your submission."
I do not want to show the user what they just submitted, and the DB that holds all the submissions is accessed with authentication only available to me.
Currently the blank form is located in localhost:3000/traders/new
then after submission, the app displays the submitted information.
First, How can I embed the form into the index page ?
Embedding your form
In your index.html.erb, add the following line:
<%= render 'form' %>
Assuming that the form partial is stored under app/view/trader with a name _form.html.erb.
Redirect
In your traders_controller.rb, edit the create action so that the user is not redirected to what the entry they submitted. I assume that there is a line like redirect_to #trader upon a successful save on the database. Instead, use something like redirect_to root_path, or wherever you want the users redirected to.
Pop-up box
In your traders.js.coffee under app/assets/javascripts, add some codes to display alert box on a successful submission of the form. Something like:
$("#your_form").submit(function(event) {
alert("Thank you for your submission.");
});
Hi i'm new to rails and i would like tohave number_field to show out after the user clicked the radio_button. For example, i have 3 radio_buttons. If the user clicked the 2nd one, it'll then show a number field to ask the user to enter some data required and later on pass to a function defined in controller after user click submit button.
Display content of database in a form with textfields in struts2.
Here is a senario. It's just an example.There is a jsp page (abc.jsp) which shows list of employees. This page contains a button (Add employee), when user clicks this button an action abcAction is called which opens xyz.jsp asking user to fill necessary information like emp_ID, emp_name, etc. On sucess abc.jsp page is opened showing the entered information on a table. Along with this informtaion an"edit" button is appeared on the same page(abc.jsp). Now how to display xyz.jsp page when user cicks edit button along with the necessary fields entered by the user based on emp_ID.
I've got a page that creates a ticket in our help desk system. It acts as a wizard with the following steps:
Step 1
User selects the customer from a dropdown list. There is a jquery onchange event that fires and generates the list for step 2 and hides the step1 div and shows the step2 div.
Step 2
User selects the location from a dropdown list. This is generated based on the customer selected in step 1. There is a jquery onchange event that fires and generates the list for step 3 and hides the step2 div and shows the step3 div.
Step 3
User selects the type from a dropdown list and enters text into 3 different text boxes. If the user fails to enter text or enters invalid text my controller changes the model state to invalid and returns the view.
How can I get all the dropdowns to repopulate again with the correct selection the user chose and get the page to redisplay on Step 3?
My first thought was to use ajax and when the user clicks the Create button, I could create the ticket from there and if successful send them to the ticket detail. If unsuccessful, well just display an error message and i'm still on the page so no big deal. Now that I write it out I think this is best. Are there any major issues using ajax? It seems most sites use some type of javascript or ajax these days.
Second thought is to not use ajax at all and submit all the pages to the server.
What do you suggest?
The 3 steps display completely different markup.
There is possibly not much you can gain by an AJAX-version, except the avoided page flicker when you change the steps.
If you go the non-AJAX way you gain:
nice bookmarkable links ( www.ticketsystem.com/Customer -> www.ticketsystem.com/Customer/Microsoft/ -> www.ticketsystem.com/Customer/Microsoft/Location -> www.ticketsystem.com/Customer/Microsoft/Location/Redmond )
browser history works
easier testing
To redisplay the lists after step 3 you would load all of them and set the selected item according to the parameter in the URL.
I agree with you. Use AJAX to submit the ticket.