Skip to content

A tiny jquery extension to build forms from JSON schema.

License

Notifications You must be signed in to change notification settings

mathlet0x/formify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jquery formify extension

A tiny jquery extension to build forms from JSON schema.

Manual

Include the minified file in your project

<script type="text/javascript" src="js/jquery.formify.min.js"></script>

Usage

$('#formify').formify(
		{
			form : {
				action : "http://127.0.0.1/form-validation.php",
				method : "POST",
			},
			fields : [
			{ 
				name : "firstname", 
			  	type : "input", 
			  	inputType : "text",
			  	placeholder : "Enter your firstname",
			  	class : "form-control"
			},
			{ 
				name : "lastname", 
			  	type : "input", 
			  	inputType : "text",
			  	placeholder : "Enter your lastname",
			  	class : "form-control"
			},
			{
				name : "address",
				type : "textarea",
				placeholder: "Enter your address",
				cols : 6,
				rows : 6,
			  	class : "form-control"
			},
			{
				name : "gender",
				type : "choice",
				choiceType : "radio",
				opts : [{label : "Male", value : "male", checked : true},
						{label: "Female", value : "female"},
						{label: "Shemale", value : "shemale"}]
			},
			{
				name : "Random choice",
				type : "select",
				opts : [{ name : "Choice 1", value : "choice1"}, 
						{name : "Choice 2", value : "choice2"}],
				class : "form-control"
			},		
			{
				type : "input",
				inputType: "submit",
				value: "Submit",
				class : "btn btn-primary"
			}
		]
	}
);

ToDo

  • Implement ajax and check inputs on form validation

About

A tiny jquery extension to build forms from JSON schema.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published