Hi, i'm using a datasource to show some data in a Grid, and using a Form to edit, problem is, that i need to use a password validator, but i want it next to the original password field.
I tried putting the original pass field last in the datasource, and adding the passwordValidatorField after that, but as seen in the image, didn't work.
Is there a way to add a Field (in this case, the password validator) in a specific position? say, i want the original password field first and the password validator second, and the others fields as they are/get.
Here's my code.
I tried putting the original pass field last in the datasource, and adding the passwordValidatorField after that, but as seen in the image, didn't work.
Is there a way to add a Field (in this case, the password validator) in a specific position? say, i want the original password field first and the password validator second, and the others fields as they are/get.
Here's my code.
Code:
// grid & form data source DataSource dataSource = UserDataSource.getInstance(); final DynamicForm userForm = new DynamicForm(); userForm.setDataSource(dataSource); userForm.setUseAllDataSourceFields(true); // we create a header for the form HeaderItem header = new HeaderItem(); header.setDefaultValue(messages.users()); // for the user form we want to have a second password field // to validate that there are no user errors when typing the password // second password field validator MatchesFieldValidator validatePassword = new MatchesFieldValidator(); validatePassword.setOtherField(UserDataSource.PASS_FIELD); validatePassword.setErrorMessage(messages.passwordsDontMatch()); // adding a second pssword field PasswordItem passwordField2 = new PasswordItem(); passwordField2.setName(UserDataSource.PASS_FIELD + "2"); passwordField2.setTitle(messages.passwordAgain()); passwordField2.setRequired(false); passwordField2.setValidators(validatePassword); userForm.setFields(header, passwordField2);
Comment