Jul 26, 2008

Dynamic Forms Help - How Do I Create These?

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > HTML, XML etc..

free web hosting

Dynamic Forms Help - How Do I Create These?

sonesay
Hi I have a page with a form with some input fields. When it is submited it goes to the comfirmation page. I want the form to have an input / button where if the user can enter/add more fields for input.

i.e

<form>
<input 0>
<input 1>

<input 2> or <button> <submit> --> (update this form with more input fields)

<input ..>
<input ..>

<submit button> --> (submit to confirm.php)
</form

I want the user to be able to enter a value or have a <add form> button to be able to add more fields. I've tried searching the web but havent been able to find anything that works.

Reply

ghostrider
I actually worked with this concept just a couple days ago working for one of my clients. If you have experience with PHP i'll be glad to explain to you how I did.

Reply

reconraiders
Use javascript. You can just set some of the input fields to invisible through CSS (the ones you don't want to show up at first). Then use javascript to change the visibility to visible when you click the button or whatever. If you want I can write up a whole script for you.

Reply

sonesay
The problem with creating the fields and then showing them later is they are fix number of fields. What I am after is the user to be able to select their own number of fields limited from 0-16 fields. I Guess since i would only be using 0-16 fields max that method of creating all 16 then showing them later would work. I think having a button to add or remove those additional input fields is what I am after. Is it possible? Also after being submitted I would need to retain and show what the user submitted in the confirm.php before being processed into the database.

If its not too much trouble I would like to see both your examples so I can decide which one is more suited to what I want. Thanks for your help guys.

Reply

reconraiders
I made a little something real quick. I'm not very good with javascript, so I'm sure the script could be made more efficient. But I think this is what you wanted.

See a working example

The javascript source
CODE
function addField() {
    id = document.getElementById('next');
    cnt = id.value;
    if(parseInt(cnt) == 16) {
        btn = document.getElementById('add');
        btn.disabled = true;
    }
    id.value = (parseInt(cnt)+1);
    field = 'field'+String(cnt);
    el = document.getElementById(field);
    el.style.display = 'block';
}


The CSS to make the fields invisible initially
CODE
#field6, #field7, #field8, #field9, #field10, #field11, #field12, #field13, #field14, #field15, #field16 {
display:none;
}


The XHTML for the form
CODE
<form action="" method="post">
<div id="field1">Input 1 <input type="text" id="input1" name="input1" /></div>
<div id="field2">Input 2 <input type="text" id="input2" name="input2" /></div>
<div id="field3">Input 3 <input type="text" id="input3" name="input3" /></div>
<div id="field4">Input 4 <input type="text" id="input4" name="input4" /></div>
<div id="field5">Input 5 <input type="text" id="input5" name="input5" /></div>
<div id="field6">Input 6 <input type="text" id="input6" name="input6" /></div>
<div id="field7">Input 7 <input type="text" id="input7" name="input7" /></div>
<div id="field8">Input 8 <input type="text" id="input8" name="input8" /></div>
<div id="field9">Input 9 <input type="text" id="input9" name="input9" /></div>
<div id="field10">Input 10 <input type="text" id="input10" name="input10" /></div>
<div id="field11">Input 11 <input type="text" id="input11" name="input11" /></div>
<div id="field12">Input 12 <input type="text" id="input12" name="input12" /></div>
<div id="field13">Input 13 <input type="text" id="input13" name="input13" /></div>
<div id="field14">Input 14 <input type="text" id="input14" name="input14" /></div>
<div id="field15">Input 15 <input type="text" id="input15" name="input15" /></div>
<div id="field16">Input 16 <input type="text" id="input16" name="input16" /></div>
<input type="hidden" id="next" value="6" />
<div><input type="button" id="add" name="add" value="Add a Field" onclick="addField();" /></div>
<br />
<br />
<div><input type="submit" value="Submit" /></div>
</form>


The hidden input called "next" keeps track of the counter. Each time you click the add field button javascript will change the display property of the current element from "none" to "block". Then it will increment the value of the hidden input called "next". Like I said, this can probably be improved. I just made it real quick.

 

 

 


Reply

jlhaslip
Awesome little script. I might just use this myself ... Thanks for helping out... that is what i like about the Trap17 Forums. Everyone chips in to assist one another.

Reply

sonesay
Thanks for that awsome example. Javascript is so awsome I need to learn more about it.

Reply

Lyon2
Making web forms for your web application, either swebsite, blog, forum, myspace site or whatever, is a ask of the past, meaning, any experienced web designer and even any web developer, do not make web forms, programming them by hand, anymore, now we do it with the proper and right programs/tools.

There are an enourmous amount of free and not free tools, which one or two you could and should buy, to create your web forms, either in cgi/perl, or in php with mysql/ms sql support, even with xml support too, and i know that all, i know about it because i have almost all the best programs of the internet to create awesome and functional and cool web forms. I know what i am talking about.

I am not about to give you the links to download the programs, i am not at home to do that, but, i know the names of the programs, and later, if you would like, i could share those links or even better, i can upload them to my server for you and all to download.


The best programs to create web forms are (freeware and shareware):


Coffeecup web forms creator
Creates flash web forms with dynamic languages, namely, php and xml plus the html files and txt files too, you can create just awesome web forms, here is an example i created for my website visitors:
http://free-flash-clocks.trap17.com/contact.html


Web form designer
Creates web forms with cgi/perl support, rather spectacular this tool to create cgi web forms.


Visual form mail
Creates also cgi web forms, pretty useful too in fact.


Asp Data Form
This one is awesome for asp users, it creates, with a awesome program interface, asp forms with microsoft access (*.mdb) databases support, it is so easy that you will optimize your work a lot with this tool, and it creates asp web forms completely free of errors.


Fast Forms
It creates web forms with support for php, cgi and perl, xml, and with support for integrating a database server like mysql, ms sql and others, this one is very complete.


There are more, at least 5 more which i have installed on my computer, and which i tryed and they all work just fine.

Get the download links by asking google where they are, they are very easy to find, and perhaps you will find even more cool tools now.

Reply

reconraiders
QUOTE(Lyon2 @ Jul 19 2007, 07:45 AM) *
Making web forms for your web application, either swebsite, blog, forum, myspace site or whatever, is a ask of the past, meaning, any experienced web designer and even any web developer, do not make web forms, programming them by hand, anymore, now we do it with the proper and right programs/tools.


I don't think that's totally accurate. I know lots of programmers who always hand code everything. I know I always do too. I use dreamweaver for the color coding and for the quick complete things for tags. But other than those two little tricks I do everything by hand.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : dynamic, forms, create,

  1. How To Make Cms For My Dynamic Website?
    A Content Management System (3)
  2. Dynamic Button Size
    (1)
    In my application I have a custom tag that generates all the action buttons that the page needs. My
    problem is that in IE the space between the left side of the button and the image inside the button
    are not consistant. Some buttons have 3 or 4 more pixels of padding on the left side then others.
    This causes my buttons to be too large and hence the area the buttons are generated in stretches too
    far. I could wrap the buttons around to another line or add scroll bars.. but if it will fit in FF I
    think it should fit in IE as well. So my question is can I set the padding....
  3. Sending Forms To A Different Location
    (5)
    Need some help, i have been out of the HTML programming for a while, and it isn't coming back
    very fast for me, or this isnt possible. Can i send the contents of a form to a different place
    then where the browser goes. I would like to send the contents of a form to a page where it will
    take the data and process it, basically putting all the data into a SQL table and creating a new
    file for the article. I want the user to go to a different page though, actually, back to the same
    form where they put in the information in the first place. Possible? ....
  4. Dynamic Drop Down Lists
    (0)
    I've got 3 drop down lists. The first one changes what appears in the second two. For some
    reason the code below is only deciding to show me the first two items that appear in the two drop
    down lists in question. So, this leads me to believe the problem shuld be quite simple to solve!
    but i've been stuck on it for a couple of hours now! If someone could help me out here
    I'd be extremely extremely greatful!!!! CODE <select
    name="free_item" onchange="relate(this.form)"> <option selected
    value=&....
  5. Dynamic Links
    (3)
    his may be a CSS question, but it's the XHTML not validating that's giving me a problem.
    I'm working with the most out-dated shopping cart software (Click Cart Pro) ever and I'm
    trying to get it to validate XHTML 1.0 Transitional. All the XHTML I've supplied is good and
    validates fine, but where I'm falling short at the moment is with the linking. ClickCart Pro -
    by default - spits out HTML from 1996, and the links are supplied with ampersands - not the XHTML
    character entity "&". Par l'exemple: Code: CODE <a href="http:....
  6. Xhtml Forms Layout
    all within the standars (8)
    We all remember the good old tables right? When we used them to design or beloved websites. But
    nowadays things have change a little bit, strict code format, css, xhtml and no tables. And so
    when it comes finally to the design of a form, instead of having two rows (left row with the label
    and right row with the input tag) and those rows aligned to look nice (left row= right aligned and
    right row=left aligned), how can we keep order with our fancy style sheet? Thanks in advance.....
  7. Substitute Form Button For An Image
    homemade images in forms buttons (3)
    Hi, I have the next formular : CODE  <form method='post'
    action='index.php?mode=2&id=1'>                <input type='hidden'
    name='name' value='Canon Digital Ixus 700'/>                <input
    type='hidden' name='id' value='1'/>                <input
    type='hidden' name='qty' value='1'>                <input
    type='hidden' name='cost' value='40'>                <input
    type='submit' value='Add to ca....
  8. "dynamic Instance"
    (0)
    My problem is the following: I work disconnected (no asp nor php etc...), with formsplayer What I
    want to do is to change dynamically (script javascript) the source of the model instance. I thougth
    about Something like: .... <script for="trChangeInstance" event="DOMActivate"
    language="JScript"> ChangeModelInstance(); function ChangeModelInstance() { var theModel =
    document.getElementById("myModel"); var theInstance = document.getInstanceElement("myData"); //...
    //Change source to page2.xml //... theModel.refresh(); } Change instance source But ....

    1. Looking for dynamic, forms, create,

Searching Video's for dynamic, forms, create,
advertisement



Dynamic Forms Help - How Do I Create These?



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE