I don’t know why I get this error, a few days ago everything went fine. Even though I downloaded the sample for User Registration and I match that code with the mine and it worked fine as I said.
Please your support
I register a user using backendless for Android,and I get the error: "Password Property is required"
Provide a small piece of code that demonstrates your issue
private void onRegisterButtonClicked()
{
String emailText = emailField.getText().toString().trim();
String last_nameText = last_nameField.getText().toString().trim();
String nameText = nameField.getText().toString().trim();
String passwordText = passwordField.getText().toString().trim();
String conf_passwordText = conf_passwordField.getText().toString().trim();
// String sexText = sexField.getText().toString().trim();
if ( emailText.isEmpty() )
{
showToast( "Field 'email' cannot be empty." );
return;
}
if ( nameText.isEmpty() )
{
showToast( "Field 'name' cannot be empty." );
return;
}
if ( last_nameText.isEmpty() )
{
showToast( "Field 'name' cannot be empty." );
return;
}
if (!mujer.isChecked() && !hombre.isChecked())
{
showToast( "You must choose a gender." );
return;
}
if ( passwordText.isEmpty() )
{
showToast( "Field 'password' cannot be empty." );
return;
}
if (conf_passwordText.isEmpty() )
{
showToast( "Field 'Confirmar password' cannot be empty." );
return;
}
if( !emailText.isEmpty() )
{
email = emailText;
}
if( !last_nameText.isEmpty() )
{
last_name = last_nameText;
}
if( !nameText.isEmpty() )
{
name = nameText;
}
if( !passwordText.isEmpty() )
{
password = passwordText;
}
if( !conf_passwordText.isEmpty() )
{
conf_password = conf_passwordText;
}
user = new Users();
if( email != null )
{
user.setEmail( email );
}
if( last_name != null )
{
user.setLast_name( last_name );
}
if( name != null )
{
user.setName( name );
}
if( password != null )
{
user.setPassword(password);
}
if( sex != null )
{
user.setSex( sex );
}
if(!conf_password.equals(password))
{
showToast("Passwords don't match");
return;
}
else
{
user.setHizoCuestionario("no");
Backendless.UserService.register( user, new DefaultCallback<BackendlessUser>( RegisterActivity.this )
{
@Override
public void handleResponse( BackendlessUser response )
{
super.handleResponse( response );
startActivity( new Intent( RegisterActivity.this, RegistrationSuccessActivity.class ) );
finish();
}
} );
}
}
adn this is my User class Table:
ublic class Users extends BackendlessUser {
public String objectId;
public String name;
public String email;
public String password;
public String last_name;
public String hizoCuestionario;
public String sex;
public String photo;
public List<Comentarios> comentario;
public List<Pregunta_por_categoria> pregunta;
public List<Comentarios> getComentario() {
return comentario;
}
public void setComentario(List<Comentarios> comentario) {
this.comentario = comentario;
}
@Override
public String getEmail() {
return email;
}
@Override
public void setEmail(String email) {
this.email = email;
}
@Override
public String getObjectId() {
return objectId;
}
public void setObjectId(String objectId) {
this.objectId = objectId;
}
@Override
public String getPassword() {
return password;
}
@Override
public void setPassword(String password) {
this.password = password;
}
public String getPhoto() {
return photo;
}
public void setPhoto(String photo) {
this.photo = photo;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getHizoCuestionario() {
return hizoCuestionario;
}
public void setHizoCuestionario(String hizoCuestionario) {
this.hizoCuestionario = hizoCuestionario;
}
public String getLast_name() {
return last_name;
}
public void setLast_name(String last_name) {
this.last_name = last_name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<Pregunta_por_categoria> getPregunta() {
return pregunta;
}
public void setPregunta(List<Pregunta_por_categoria> pregunta) {
this.pregunta = pregunta;
}
}
- Extending BackendlessUser is a bad idea.
The properties (fields) in your class will not be sent to the server as expected and they will not get initialized as you'd expect when data arrives from the server.
Instead of subclassing BackendlessUser, use the setProperty/getProperty of the BackendlessUser class.
Hi Mark, now it’s working very well, thanks a lot.