Trouble with validating through a webservice on the blur event

9 posts, 0 answers
  1. Joshua
    Joshua avatar
    5 posts
    Member since:
    Aug 2009

    Posted 14 Sep 2009 Link to this post

        <telerik:RadInputManager ID="RadInputManager1" runat="server">   
           <telerik:TextBoxSetting BehaviorID="TextBoxBehavior1" ErrorMessage="BAD!">  
                <Validation   
                    Location="/Services/Membership.svc"   
                    ValidateOnEvent="All" 
                    Method="ValidNewUsername" 
                 /> 
                <TargetControls> 
                    <telerik:TargetInput ControlID="TextBox1" /> 
                </TargetControls>       
                <ClientEvents OnValidating="onValidating" />     
            </telerik:TextBoxSetting>     
        </telerik:RadInputManager>      
          
        <script type="text/javascript">  
            function onValidating(sender, args) {  
                alert('hello');                            
            }      
        </script> 

    I have successfully configured a webservice to validate a textbox; however, it only occurs on the submit and not on the blur. The client-side onValidating function is being called on the blur, but there is no visual sign or invalid values despite the service returning a false. When I submit the form, however, the typical error messages are displayed (without a server trip). How can I get the error messages to display on blur?
  2. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 17 Sep 2009 Link to this post

    Hi Joshua,

    I could not reproduce this problem as evidenced by the attached sample. Could you take a look at it and get back with more information if I have missed something.

    All the best,
    Tsvetoslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Joshua
    Joshua avatar
    5 posts
    Member since:
    Aug 2009

    Posted 17 Sep 2009 Link to this post

    I am seeing the same errant behavior with the sample you supplied.

    Perhaps I misunderstand the ValidateOnEvent options. I am assuming when I specify either "All" or "Blur" the following will occur:

    1. I type an errant value in the box
    2. I hit the TAB key, or click the focus away from the box
    3. The value is validated and error displayed

    Currently, both in my work and your sample, I can only get the validation to occur when I click on the submit button.

    I've tried in IE7&8, FF & Chrome
    .NET Framework 3.5.30729.1
    Telerik.Web.UI.dll version 2009.2.701.35
    IIS 7.0.6000.16386 (on Vista x64 SP2)

  4. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 23 Sep 2009 Link to this post

    Hello Joshua,

    I have attached a screen-cast which demonstrates that the web service validation behaves as expected on my side.
    Could you try running the sample with the latest build and see if it makes a difference. Thanks

    Best wishes,
    Tsvetoslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Joshua
    Joshua avatar
    5 posts
    Member since:
    Aug 2009

    Posted 23 Sep 2009 Link to this post

    I ran the sample with the latest build (2009.2.920), and it worked correctly. I'll try that first next time. Thanks for your help.
  6. Joshua
    Joshua avatar
    5 posts
    Member since:
    Aug 2009

    Posted 24 Sep 2009 Link to this post

    Tsvetoslav, another issue with the same functionality...

    Using your same sample code, I can neither get an error message to be displayed using the ErrorMessage attribute nor display a custom error message because the OnError of ClientEvents will not fire with this type of validation.

    How am I able to dyanimcally (client-side) post a message to the end user of why his input has failed validation?

    Thanks!
  7. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 25 Sep 2009 Link to this post

    Hi Joshua,

    The behavior you are observing is by design - when the validation fails just the Exclamation sign is displayed to indicate that. We shall need some time to investigate the issue and see if it is expedient to change this behavior and will get back to you with the result.

    Best Regards,
    Tsvetoslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  8. Joshua
    Joshua avatar
    5 posts
    Member since:
    Aug 2009

    Posted 25 Sep 2009 Link to this post

    Tsvetoslav,

    Thank you for the quick reply.

    Without a method to present an error message to the user, use of this validation function causes a failure in the basic requirements of proper UI design.  I look forward to the implementation of addition functionality to make this a usable feature.

    Once complete, the ease-of-use of this feature is sure to be a strong asset to the RadInput

    If it does go into development, might I suggest that given the data-centric nature of validating through a webservice, BOTH the ErrorMessage attribute AND the OnError hook are vital in creating a full-functioning UI. That is, you will often want to present the user with an error AND addition information and/or functionality.

    Lastly, I would recommend adding to the documentation that the custom webservice must accept two string values specifically named "id" and "value". It already states what the parameters are for and their types; however, it leaves out that the AJAX code requires them to be specifically named. This would have saved a good amount of debugging/development time.

    Thanks for all your help.
    JOSH
  9. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 28 Sep 2009 Link to this post

    Hello Joshua,

    I have logged the newly-suggested feature into our system and we shall try to get it ready for the next release of the controls.

    As for the help topic - I guess, you had in mind the online example on RadInputManager's web service validation: we shall add the additional detail you mentioned about the parameter names.

    Meanwhile, I have updated your Telerik points. Thanks for the feedback.

    Regards,
    Tsvetoslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top