This repository has been archived by the owner on Mar 5, 2024. It is now read-only.
forked from jsonform/jsonform
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated readme to include a "Getting started" example.
Also added an example.html file that matches the "Getting started" example.
- Loading branch information
Francois Daoust
committed
Jun 4, 2012
1 parent
cb0b955
commit 62de530
Showing
2 changed files
with
118 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Getting started with JSON Form</title> | ||
<link rel="stylesheet" style="text/css" href="deps/opt/bootstrap.css" /> | ||
</head> | ||
<body> | ||
<h1>Getting started with JSON Form</h1> | ||
<form></form> | ||
<div id="res" class="alert"></div> | ||
<script type="text/javascript" src="deps/jquery.min.js"></script> | ||
<script type="text/javascript" src="deps/underscore.js"></script> | ||
<script type="text/javascript" src="deps/opt/jsv.js"></script> | ||
<script type="text/javascript" src="lib/jsonform.js"></script> | ||
<script type="text/javascript"> | ||
$('form').jsonForm({ | ||
schema: { | ||
name: { | ||
type: 'string', | ||
title: 'Name', | ||
required: true | ||
}, | ||
age: { | ||
type: 'number', | ||
title: 'Age' | ||
} | ||
}, | ||
onSubmit: function (errors, values) { | ||
if (errors) { | ||
$('#res').html('<p>I beg your pardon?</p>'); | ||
} | ||
else { | ||
$('#res').html('<p>Hello ' + values.name + '.' + | ||
(values.age ? '<br/>You are ' + values.age + '.' : '') + | ||
'</p>'); | ||
} | ||
} | ||
}); | ||
</script> | ||
</body> | ||
</html> |