var optInSettings;
var allCardsTemplate;
+var dupeUsrname = false;
+var dupeBarcode = false;
if(!window.xulG) var xulG = null;
dojo.connect(widget.widget, 'onChange',
function() {
var barcode = this.attr('value');
+ dupeBarcode = false;
dojo.addClass(dojo.byId('uedit-dupe-barcode-warning'), 'hidden');
fieldmapper.standardRequest(
['open-ils.actor', 'open-ils.actor.barcode.exists'],
oncomplete : function(r) {
var res = openils.Util.readResponse(r);
if(res == '1') {
+ dupeBarcode = true;
dojo.removeClass(dojo.byId('uedit-dupe-barcode-warning'), 'hidden');
} else {
+ dupeBarcode = false;
dojo.addClass(dojo.byId('uedit-dupe-barcode-warning'), 'hidden');
var un = findWidget('au', 'usrname');
if(!un.widget.attr('value'))
var usrname = input.widget.attr('value');
if(!usrname) {
+ dupeUsrname = false;
dojo.addClass(dojo.byId('uedit-dupe-username-warning'), 'hidden');
return;
}
oncomplete : function(r) {
var res = openils.Util.readResponse(r);
if(res) {
+ dupeUsrname = true;
dojo.removeClass(dojo.byId('uedit-dupe-username-warning'), 'hidden');
} else {
+ dupeUsrname = false;
dojo.addClass(dojo.byId('uedit-dupe-username-warning'), 'hidden');
}
}
function _uEditSave(doClone) {
+ if ( (! myForm.isValid()) || dupeUsrname || dupeBarcode ) {
+ alert('Form is invalid. Please edit and try again.');
+ return;
+ }
+
for(var idx in widgetPile) {
var w = widgetPile[idx];
var val = uEditWidgetVal(w);
</style>
-<table>
- [% INCLUDE default/actor/user/register_table.tt2 %]
-</table>
+<div dojoType="dijit.form.Form" id="myForm" jsId="myForm" encType="multipart/form-data" action="" method="">
+ <script type="dojo/method" event="onSubmit">
+ /* we don't want to use the form action, but uEditSave and UEditSaveClone from the Save buttons. We
+ do want to use the Form's validation features, which we do from within UEditSave, etc. */
+ return false;
+ </script>
+ <table>
+ [% INCLUDE default/actor/user/register_table.tt2 %]
+ </table>
+</div>
<div id='uedit-save-div'>
<button dojoType='dijit.form.Button' jsId='saveButton' onClick='uEditSave'>Save</button>