Editing bug fix for validation

pull/105/merge
Michael Jett 2012-05-22 15:19:47 -04:00
parent a44dee1fd6
commit c85248c40c
1 changed files with 17 additions and 15 deletions

View File

@ -190,7 +190,7 @@
$('.control-group').removeClass('error');
this.model.set({
var valid = this.model.set({
clientName:$('#clientName input').val(),
clientSecret:$('#clientSecret input').val(),
registeredRedirectUri:$.trim($('#registeredRedirectUri textarea').val()).replace(/ /g,'').split("\n"),
@ -201,26 +201,28 @@
scope:$.map($('#scope textarea').val().replace(/,$/,'').replace(/\s/g,' ').split(","), $.trim)
});
this.model.save(this.model, {
success:function () {
app.navigate('clients', {trigger: true});
},
error:function() {
}
});
if (this.model.isNew() && this.model.isValid()) {
var self = this;
app.clientList.create(this.model, {
if (valid) {
this.model.save(this.model, {
success:function () {
app.navigate('clients', {trigger: true});
app.navigate('clients', {trigger:true});
},
error:function() {
error:function () {
}
});
if (this.model.isNew()) {
var self = this;
app.clientList.create(this.model, {
success:function () {
app.navigate('clients', {trigger:true});
},
error:function () {
}
});
}
}
return false;