Blogger news

Create Form Dynamically And Increment Value,javascript,phptaab,php taab

taabin | 00:38 | 0 comments

Create Form Dynamically And Increment Value,javascript,phptaab,php taab

How To Dynamically Add kind Fields And Increment “Name” Attribute Of the sector phptaab

In this tutorial you'll learn-how {to make|to kind|to create} dynamic form with JavaScript codes. The fields ar dynamically supplementary within the kind. With it, “Name” and “message” fields get incremented on click of various buttons.


index.php

<!DOCTYPE html>
<html>
<head>
<title>Create Form Dynamically And Increment Value- Demo Preview</title>
<meta content="noindex, nofollow" name="robots">
<script src="form.js" type="text/javascript"></script>
<link href="form.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="main">
<div class="header">
<h1>Create Form Dynamically And Increment Value</h1>
</div>
<!--
=================
First Div for the buttons. Click on the button to add field on the forms.
=================
-->
<div class="two">
<button class="name" onClick="textBoxCreate()">Name</button>
<button class="email" onClick="emailBoxCreate()">Email</button>
</div>
<!--
=================
Form fields get added in the third div.Click on the button to add field on the forms.
=================
-->
<div class="third">
<form action="" id="mainform" method="get" name="mainform">
<p id="myForm"></p><input type="submit" value="Submit">
</form>
</div>
</div>
</body>
</html>

form.js

// FormGet Online Form Builder JS Code
// Creating and Adding Dynamic Form Elements.
var i = 1;// Global Variable for Name
var j = 1;// Global Variable for E-mail
/*
=================
Creating Text Box in the Form Fields.
=================
*/
function textBoxCreate(){
var y = document.createElement("INPUT");
y.setAttribute("type", "text");
y.setAttribute("Placeholder", "Name_" + i);
y.setAttribute("Name", "Name_" + i);
document.getElementById("myForm").appendChild(y);
i++;
}
/*
=================
Creating Textarea in the Form Fields.
=================
*/
function emailBoxCreate(){
var y = document.createElement("INPUT");
var t = document.createTextNode("Email");
y.appendChild(t);
y.setAttribute("Placeholder", "Email_" + j);
y.setAttribute("Name", "Email_" + j);
document.getElementById("myForm").appendChild(y);
j++;
}
}

DOWNLOAD All FILES

You can take a read on screenshots that shows dynamically addition of kind parts.

As we have a tendency to click on the fields, they'll seem on the proper aspect. during this method, you'll be able to dynamically add fields and make kind.

Create Form Dynamically And Increment Value,javascript,phptaab,php taab


Conclusion Words:

To create dynamic kind via code snipping is quiet troublesome. currently it’s simple for your to transfer the codes and use it on your project.

Category:

About GalleryBloggerTemplates.com:
GalleryBloggerTemplates.com is Free Blogger Templates Gallery. We provide Blogger templates for free. You can find about tutorials, blogger hacks, SEO optimization, tips and tricks here!

0 comments