This is a migrated thread and some comments may be shown as answers.

Update password in the grid with password match option

1 Answer 265 Views
Grid
This is a migrated thread and some comments may be shown as answers.
JOHNY
Top achievements
Rank 1
JOHNY asked on 20 Mar 2013, 05:46 PM
Hi Telerik team
   I have a grid with InCell editing
      .Name("UserDetailsGrid").Editable(editable=> editable.Mode(GridEditMode.InCell) )

 This grid has a column Password      
   columns.Bound(p=> p.Password).ClientTemplate("***").Title("Password").Width(200);

   On  Edit / Create New  I need to have
a password confirm option which will force the user to type the password two times.

   This is required because I am not
displaying the password to the user in the grid. I am displaying it using
 ClientTemplate("***") which will show * on the grid 

  Can you help me to solve this issue. This way or some other better way.
 
Thanks

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 22 Mar 2013, 11:53 AM
Hello Johny,

Basically to achieve such behavior you will have to create custom editor template like explained here and also combine it with the save event of the Grid - so you can perform that custom validation.

Here is an example :
//specify custom editor
 
columns.Bound(c => c.Password).EditorTemplateName("password");
 
//... add handler to the save event
 
 .Events(ev=>ev.Save("onSave"))   
 
// declare the save handler
 
<script type="text/javascript">
    function onSave(e) {       
        if (!e.model.get('Password') || e.model.get('Password') != $('#rpt').val()) {
            e.preventDefault(); //prevent from saving if the values does not match
        }
    }
</script> 

The custom editor should be something like this:

@model string
  
@Html.PasswordFor(m=>m)
<br />
<input type="password" id="rpt" />


I hope this helps.

Kind Regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
JOHNY
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or