2012-11-01 87 views
1

我想爲我的解析SignUp函數添加一個額外的屬性。我的代碼是這樣如何添加額外的屬性到分析註冊功能?

signUp: function(e) { 
    var self = this; 
    var username = this.$("#signup-username").val(); 
    var password = this.$("#signup-password").val(); 
    var sex=this.$("#signup-sex").val(); 
    Parse.User.signUp(username, password, sex, { ACL: new Parse.ACL() }, { 
    success: function(user) { 
     new ManageTodosView(); 
     self.undelegateEvents(); 
     delete self; 
    } 

如果我只傳遞用戶名和密碼,它的工作原理,並增加了用戶數據庫。

回答

0

文檔顯示只有4對Parse.User.signUp函數參數:http://www.parse.com/docs/js/symbols/Parse.User.html#signUp

我的猜測是,這將這樣的伎倆:

signUp: function (e) { 
    var self = this; 
    var username = this.$("#signup-username").val(); 
    var password = this.$("#signup-password").val(); 
    var sex = this.$("#signup-sex").val(); 
    var otherAttribute = 'test'; 
    Parse.User.signUp(username, password, { 
     sex: sex, 
     newAttribute: otherAttribute, 
     ACL: new Parse.ACL() 
    }, { 
     success: function (user) { 
      new ManageTodosView(); 
      self.undelegateEvents(); 
      delete self; 
     } 
    } 
} 
0

你可以像下面這樣做

var user = new Parse.User(); 
user.set('username',name); 
user.set('YOUR_COLUMN','ITS_VALUE'); 
user.set('password',password); 
user.set('YOUR_COULMN','ITS_VALUE'); 

user.signUp(null,{ 
    success:function(user){ 
     NEXT OPERATION 
    }, 
    error:function(error){ 
     res.send('error::'+error.message); 
    } 

}); 
2
var attrs = {ACL: new Parse.ACL(), email: "[email protected]"}; 

Parse.User.signUp(username, password, attrs, { 

    success: function(user) { 
     //Set the code for sucess 
    }, 

    error: function(user, error) { 
    alert("Error: " + error.code + " " + error.message); 
    } 
}); 
相關問題