[C#/ASP.NET] RadInputManager does not submit inputsettings

4 posts, 1 answers
  1. Michiel
    Michiel avatar
    12 posts
    Member since:
    Feb 2011

    Posted 17 Jul 2012 Link to this post

    Hello,

    Currently I'm facing a small problem with the RadInputManager. Somehow when I call clientside an onSubmit on the RadInputManager my inputsettings are not validated / are not triggered. I'm still unable to find the problem what is causing this. Maybe there is a slight chance that you can provide me with an answer?

    Environment: Visual Studio 2010
    .NET Framework: 3.5
    Version: 2012.1.411.35

    Declaration of the radinputmanager:

    <telerik:RadInputManager ID="InputManager" runat="server" EnableEmbeddedScripts="false" EnableEmbeddedBaseStylesheet="false" EnableEmbeddedSkins="false" RegisterWithScriptManager="false">
        <telerik:RegExpTextBoxSetting Validation-IsRequired="false" InitializeOnClient="true" ValidationExpression="^[0-9]+$"> 
        </telerik:RegExpTextBoxSetting>
        <telerik:TextBoxSetting Validation-IsRequired="true" InitializeOnClient="true">
        </telerik:TextBoxSetting>
        <telerik:TextBoxSetting Validation-IsRequired="true" InitializeOnClient="true">
             <Validation IsRequired="true" ValidateOnEvent="All"/>
        </telerik:TextBoxSetting>
        <telerik:TextBoxSetting Validation-IsRequired="true" InitializeOnClient="true">
             <Validation IsRequired="true" ValidateOnEvent="All"/>
        </telerik:TextBoxSetting>
    </telerik:RadInputManager>

    Declaration in javascript:
        // Validates the object data
        // @return void
        this.validate = function () {
            var result = true;

            // Get the input manager
            var inputManager = $find("<%=InputManager.ClientID%>");

            // Do already a submit to make sure that all validations are triggered
            inputManager._onSubmit();

            // Get the current settings of the input manager
            var settings = inputManager._getSettings();

            // Start validating all settings
            for (var setting in settings) {
                if (!this.validateInputField($find(setting))) {
                    result = false;
                    break;
                }
            }

            return result;
        };

        // Validates a input field
        // @param setting: The setting to validate
        // @return bool: True when the setting was valided successfully
        this.validateInputField = function (setting) {
            var result = true;

            for (var input in setting._inputs) {
                result = !setting._inputs[input]._invalid;

                if (!result) {
                    break;
                }
            }

            return result;
        };

    What am I doing wrong? :)
  2. Michiel
    Michiel avatar
    12 posts
    Member since:
    Feb 2011

    Posted 17 Jul 2012 Link to this post

    It seems to be that I have it fixed now, but now something else occur. Maybe this is by design but I think it is a small flaw which has been slipped through the fingers of the developers ;-).. anyway this is the way how I now have currently fixed it:

            var result = true;

            // Get the input manager
            var inputManager = $find("<%=InputManager.ClientID%>");

            // Do already a submit to make sure that all validations are triggered
            inputManager._onSubmit();

            // Get the current settings of the input manager
            var settings = inputManager.get_inputSettings();

            // Start validating all settings
            for (var settingKey in settings) {
                // Trigger the setting to validate the associated fields
                if (!settings[settingKey].isValid()) {
                    result = false;
                }
            }

            return result;

    In one of the settings I have 4 targetcontrols defined. When I trigger the isValid method the emptyMessage is not correctly displayed in the textbox (there is no empty message). When 1 targetcontrol is defined the emptyMessage is correctly displayed. Is this by design or?
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 20 Jul 2012 Link to this post

    Hello Michiel,

    I was unable to replicate the project in sample page, so not sure why you are facing this issue.
    When the validation is executed the empty message will be changed to the error message if the input is required and still empty. If you error message is empty string, it will look like the empty message is just missing.

    All the best,
    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.
  5. Michiel
    Michiel avatar
    12 posts
    Member since:
    Feb 2011

    Posted 20 Jul 2012 Link to this post

    Hello Vasil,

    First or all thank you for your reply and second yes it was indeed correct that my error message was not filled in. I had completely misunderstood the EmptyMessage and ErrorMessage property. I thought that when I have nothing filled in that my EmptyMessage is displayed but that was kinda.. eumh stupid of me to think that :).
Back to Top