Solved

Form to handle multiple entries

Posted on 2011-09-14
5
258 Views
Last Modified: 2012-05-12
I have a form with 12 fields. This form submits the information for registering a student for courses that we offer. Currently, it only handles one registration at a time and is kind of clunky.

I want to present the user the capability to register more than one person at a time. Essentially adding multiple users' info at once before submitting the form.

I also want to have an area above the form that shows a list of people that they enter in a select, which will later be modified to have checkboxes so they may remove them, if needed.

Anyone know of any tutorials or sample showing how to do something like this using jQuery?
0
Comment
Question by:EddieShipman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 36540262
<div id="I_WANT_TO_BE_CLONED" style="display:none">
here all the fields for a registration. It should be the content of your current form
</div>

you add a button to add a new user registration somwhere in your page:

<input type="button" id="ADD_NEW_USER_REGISTRATION" value="ADD USER REG" />

your form is by default empty (or with one user reg. if you want)

now we need to clone thediv and put it (add it) add the end of your form
additionaly, we need to unhide (show()) the cloned version :

$("#ADD_NEW_USER_REGISTRATION").click(function(e) {
    $("#I_WANT_TO_BE_CLONED").clone().show().appendTo("form");
})

Open in new window


BASIC TEST PAGE : http://jsfiddle.net/Qewnb/



0
 
LVL 26

Author Comment

by:EddieShipman
ID: 36540581
How would you deal with multiple form fields with the same name in this circumstance?
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36540589
each set of fields (a user reg.) is inside a div
on the server side, you get an array of fields for a given name
you just need to loop over it for each one

you don't have multiple forms, just one
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36540600
we've an empty form
a set of fields outside this form
each time we click on the button, we clone the set of fields to add to the form
0
 
LVL 26

Author Comment

by:EddieShipman
ID: 36542829
I an not sure that you would get an array of fields if they had the same name unless they were named name="field_xxx[]"
I understand that there is only one form. Look at how these do it:

http://www.jdmweb.com/resources/formclone
http://code.google.com/p/sheepit/

0

Featured Post

Create CentOS 7 Newton Packstack Running Keystone

A bug was filed against RDO for the installation of Keystone v3. This guide is designed to walk you through the configuration for using Keystone v3 with Packstack. You will accomplish this using various repos and the Answers file.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question