forked from vitmalina/w2ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated w2form docs and demos, improved w2form.applyFocus, Recompiled JS
updated w2form docs and demos, improved w2form.applyFocus, Recompiled JS
- Loading branch information
Showing
60 changed files
with
1,984 additions
and
1,557 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,67 @@ | ||
<div class="content"> | ||
<div id="example_title"> | ||
<h1>Apply Focus</h1> | ||
w2form<a class="argument" href="http://w2ui.com/web/docs/w2form.focus">.focus</a> can be either a string (field id) or an integer and there's | ||
also the new method w2form<a class="argument" href="http://w2ui.com/web/docs/w2form.applyFocus">.applyFocus()</a> that takes either | ||
a string or an integer as an argument.<br> | ||
Keep in mind that integer values are zero-indexed. | ||
</div> | ||
<div id="example_view"></div> | ||
<div id="example_code"></div> | ||
</div> | ||
|
||
<!--CODE--> | ||
<div id="form" style="width: 750px;"></div> | ||
<br> | ||
<button class="w2ui-btn" onClick="w2ui.form.applyFocus(0)">Focus 1st field</button> | ||
<button class="w2ui-btn" onClick="w2ui.form.applyFocus(5)">Focus 6th field</button> | ||
<button class="w2ui-btn" onClick="w2ui.form.applyFocus('comments')">Focus 'comments' field</button> | ||
<button class="w2ui-btn" onClick="w2ui.form.applyFocus()">Focus original focus field</button> | ||
|
||
<!--CODE--> | ||
<script> | ||
$(function () { | ||
$('#form').w2form({ | ||
name : 'form', | ||
header : 'Auto-Generated Form', | ||
url : 'server/post', | ||
focus : 'last_name', | ||
fields : [ | ||
{ field: 'first_name', type: 'text', required: true, | ||
html: { label: 'First Name', attr: 'style="width: 200px"' } | ||
}, | ||
{ field: 'last_name', type: 'text', required: true, | ||
html: { label: 'Last Name', attr: 'style="width: 200px"' } | ||
}, | ||
{ field: 'comments', type: 'textarea', | ||
html: { label: 'Comments', attr: 'style="width: 200px; height: 60px"' } | ||
}, | ||
{ field: 'city', type: 'text', | ||
html: { label: 'City', attr: 'style="width: 200px"', column: 2, } | ||
}, | ||
{ field: 'zip', type: 'text', | ||
html: { label: 'Zip Code', attr: 'style="width: 100px"', column: 2, } | ||
}, | ||
{ field: 'street', type: 'text', | ||
html: { label: 'Street', attr: 'style="width: 200px"', column: 2, } | ||
}, | ||
], | ||
actions: { | ||
'Reset': function (event) { | ||
this.clear(); | ||
}, | ||
'Save': function (event) { | ||
if (w2ui.form.validate().length == 0) { | ||
w2popup.open({ | ||
title: 'Form Data', | ||
with: 600, | ||
height: 550, | ||
body: `<pre>${JSON.stringify(this.getCleanRecord(), null, 4)}</pre>`, | ||
buttons: '<button class="w2ui-btn" onclick="w2popup.close()">Ok</button>' | ||
}) | ||
} | ||
} | ||
} | ||
}); | ||
}); | ||
</script> |
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
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
Oops, something went wrong.