I am doing a password editor. The password can be entered in two ways: manually entering the values for password and confirmation or by selecting some already generated password.
To use the generated password, a new value from the select box must be chosen. The change triggers the filling of the password/confirmation fields(psw1
and psw2
) with the value from the selected value.
<p:selectOneMenu value="#{password.selectedPassword}" >
<f:selectItems value="#{password.passwords}" var="val"
itemLabel="#{val}" itemValue="#{val}" />
<p:ajax update="psw1, psw2" listener="#{password.passwordChanged}"/>
</p:selectOneMenu>
I need to implement the filling of password fields also when the the same value is selected. How can I implement this? One way is to add an extra value, a default empty value.