some JS Scripting etc

Dreamweaver & Flash (ahh ahhh) plus Web related Tutorials & Resources, HTML, CSS, PHP, Flash or whatever.
Post Reply
Simon
A Pig in Space
A Pig in Space
Posts: 484
Joined: January 7th, 2006, 10:55 am
Location: Devon
Contact:

some JS Scripting etc

Post by Simon » May 23rd, 2008, 4:43 pm

any one know how I can achieve this.

I have one section of input boxes, say Name and E-Mail;

now they can either press submit or add another column, so that they can then enter another name and e-mail, but rather than have loads of input sections or have them to submit only one at a time.

So basically some code that adds another input item dynamically, I have seen these done but to the life of me cannot remember, I believe this is some clever JS ect


thanks si
there is a god, and i am him

cow
A Pig in Space
A Pig in Space
Posts: 309
Joined: January 6th, 2006, 10:44 am
Location: 4th rock from morphims house
Contact:

Post by cow » May 26th, 2008, 11:30 am

You could either use php to add more upon a page refresh, or a cleaner method (from the end-users point of view anyway) would be an ajax event, so yes - javascript. With the ajax method you'll still need to evaluate the input that's sent to the server, I'd put it in an array and you'll need to assign each input box a unique identifier. At some point you may want to validate the email address (client-side JS or more preferably server-side php). Let us know what you come up with.
<? include['cows go moo'] ?>

Simon
A Pig in Space
A Pig in Space
Posts: 484
Joined: January 7th, 2006, 10:55 am
Location: Devon
Contact:

Post by Simon » May 26th, 2008, 4:58 pm

thanks cow.

I am trying something slightly different, in which you have the one form then enter the details as much as you want then append it to a list so they can see, then once they have completed this they then cam press another button that will confirm what they have entered etc

Basically I am going to produce an online expenses form in which they will enter as many items as they want, then if ok submit the form to a db and also convert to a pdf for dowload etc

this is what i have so far, each entry will be added to the db but not with a confirm one, and when they ress the confirm button(comming soon) it will add a true to the comfirm section of the db table etc blah blah

http://www.levidyllan.co.uk/bits/testAjax.php
there is a god, and i am him

cow
A Pig in Space
A Pig in Space
Posts: 309
Joined: January 6th, 2006, 10:44 am
Location: 4th rock from morphims house
Contact:

Post by cow » May 27th, 2008, 9:41 am

That's looking pretty good. Might be an idea to clear the input boxes upon each submission?
<? include['cows go moo'] ?>

Post Reply