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

raise_passwordStrengthCalculating

4 Answers 56 Views
Input
This is a migrated thread and some comments may be shown as answers.
SSirica
Top achievements
Rank 3
Iron
Iron
Iron
SSirica asked on 22 Mar 2012, 05:18 PM
I ran across a java script function called raise_passwordStrengthCalculating but I can't find any documentaion on it or how to use it?  See I've figured out a way how to get a value from a database into a password field, but I haven't figured out how to get the password field to calculate the password strength.  And I think that function would do it, but can't quite wrap my head around how to call it.

I guess I didn't get my secret decoder ring along with my subscription.

4 Answers, 1 is accepted

Sort by
0
SSirica
Top achievements
Rank 3
Iron
Iron
Iron
answered on 22 Mar 2012, 08:31 PM
There has got to be a way manually invoke the password strengthchecking via code?  You guys have such nice tools why do you make them so hard to navigate?
0
SSirica
Top achievements
Rank 3
Iron
Iron
Iron
answered on 23 Mar 2012, 08:10 PM
OK I figured out how to invole this.  I'm using Subroutine:
Sub setTelerikValue(oObj As Object, sVal As String)
    Dim sScript As String = "<script language='javascript'>" & _
                            "function f() {$find(""" & oObj.ClientID & """).set_value('" & sVal.Trim & "'); " & _
                            "$find(""" & oObj.ClientID & """).raise_passwordStrengthCalculating();" & _
                            "Sys.Application.remove_load(f);}; " & _
                            "Sys.Application.add_load(f);</script>"
    ClientScript.RegisterStartupScript(Me.GetType(), "setPass", sScript)
End Sub

Now I'm getting an error in my OnClientPasswordStrengthCalculating java function:
function CalculatingStrength(sender, args) {
        //throw new Error;
        document.getElementById("<%=txtPassScore.ClientID%>").value = args.get_strengthScore();
}

args is empty, so it throws an error.  What am I missing?
0
Vasil
Telerik team
answered on 26 Mar 2012, 03:38 PM
Hi,

You need to construct the event args that you want to pass to the client event.

var eventArgs = new Telerik.Web.UI.PasswordStrengthCalculatingEventArgs(Value, Score, LabelText);
RadTextBox1.raise_passwordStrengthCalculating(eventArgs);

The Value that you pass in the upper code, will be the same as args.get_strengthScore() will return in your handler later.

And if you actually want to make the input to calculate the score and call the event, you need to use this code:
Telerik.Web.UI.PasswordStrengthChecker.prototype.showStrength(TextBox1, TextBox1._textBoxElement, TextBox1._passwordSettings);
where TextBox1 is the client object of your textbox.

Regards,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
SSirica
Top achievements
Rank 3
Iron
Iron
Iron
answered on 26 Mar 2012, 04:23 PM

Dude you ROCK!!!  That worked perfectly!!!  I can't thank you enough.  For anyone else interested this is the final working version of the Subroutine: 

Sub setTelerikValue(oObj As Object, sVal As String)
    Dim sScript As String = "<script language='javascript'>" & _
                            "function f() {var Obj = $find(""" & oObj.ClientID & """); " & _
                            "Obj.set_value('" & sVal.Trim & "'); " & _
                            "Telerik.Web.UI.PasswordStrengthChecker.prototype.showStrength(Obj, Obj._textBoxElement, Obj._passwordSettings); " & _
                            "Sys.Application.remove_load(f);}; " & _
                            "Sys.Application.add_load(f);</script>"
    ClientScript.RegisterStartupScript(Me.GetType(), "setPass", sScript)
End Sub

and this is how you'd call it:
            setTelerikValue(txtPassword, "PasswordValueHere")

That will set a password field and force the calculation of the password strength. 

Tags
Input
Asked by
SSirica
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
SSirica
Top achievements
Rank 3
Iron
Iron
Iron
Vasil
Telerik team
Share this question
or