Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sargento
committed
Jan 4, 2013
1 parent
a2ae25e
commit c2b4f13
Showing
1 changed file
with
25 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
var idx = 5; | ||
if (!tests[idx].jsonform.form) { | ||
tests[idx].jsonform.form = ['*']; | ||
} | ||
tests[idx].jsonform.form.push({ | ||
type: 'actions', | ||
items: [ | ||
{ | ||
type: 'submit', | ||
value: 'Submit' | ||
var $tests = $('.tests'); | ||
var idx = 0; //or enter the index like before. ex.: 5 | ||
var limit = (idx == 0 ? tests.length - 1 : idx); | ||
|
||
for (idx; idx <= limit; idx++) { | ||
if (!tests[idx].jsonform.form) { | ||
tests[idx].jsonform.form = ['*']; | ||
} | ||
] | ||
}); | ||
tests[idx].jsonform.onSubmit = function (errors, values) { | ||
console.log(errors, values); | ||
}; | ||
$("#test-id").html(tests[idx].name); | ||
$("#testform").jsonForm(tests[idx].jsonform); | ||
tests[idx].jsonform.form.push({ | ||
type: 'actions', | ||
items: [ | ||
{ | ||
type: 'submit', | ||
value: 'Submit' | ||
} | ||
] | ||
}); | ||
tests[idx].jsonform.onSubmit = function (errors, values) { | ||
console.log(errors, values); | ||
}; | ||
|
||
$('<h1>Test "<span class="test-name"></span>"</h1>').appendTo($tests); | ||
$('<form id="testform" class="form-vertical"></form>').appendTo($tests); | ||
$tests.find(".test-name").last().html(tests[idx].name); | ||
$tests.find("#testform").last().jsonForm(tests[idx].jsonform); | ||
} |