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

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

3 Answers 67 Views
Input
This is a migrated thread and some comments may be shown as answers.
Michiel
Top achievements
Rank 1
Michiel asked on 17 Jul 2012, 06:57 AM
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? :)

3 Answers, 1 is accepted

Sort by
0
Michiel
Top achievements
Rank 1
answered on 17 Jul 2012, 08:51 AM
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?
0
Accepted
Vasil
Telerik team
answered on 20 Jul 2012, 08:46 AM
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.
0
Michiel
Top achievements
Rank 1
answered on 20 Jul 2012, 09:22 AM
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 :).
Tags
Input
Asked by
Michiel
Top achievements
Rank 1
Answers by
Michiel
Top achievements
Rank 1
Vasil
Telerik team
Share this question
or