Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • christos 3 posts 23 karma points
    Apr 06, 2012 @ 20:47
    christos
    0

    Validators in backoffice application

     

    Hello, I have created a custom section in the umbraco backoffice, and I have difficulty getting asp.net validation controls to work in my forms. Here is an example of a Panel I add to an umbraco tabview:

    <umb:TabView ID="TabViewDetails" runat="server" Width="552px" Height="692px"/>

    <asp:Panel ID="PanelDetails" runat="server">

        <umb:Pane ID="detailsPane" runat="server">

            <umb:PropertyPanel ID="priceProp" runat="server" Text="Price">

                <asp:TextBox ID="price2" runat="server" CssClass="textField"></asp:TextBox>

                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 

                    ControlToValidate="price2" ErrorMessage="RequiredFieldValidator" ValidationGroup="main"

                    ></asp:RequiredFieldValidator>

            </umb:PropertyPanel>

        </umb:Pane>

    </asp:Panel>

    In the code behind I set up the form and save button like this:

                TabPage dataTab = TabViewDetails.NewTabPage("Details");

                dataTab.Controls.Add(PanelDetails);

                ImageButton saveButtonData = dataTab.Menu.NewImageButton();

                saveButtonData.ValidationGroup = "main";

                saveButtonData.CausesValidation = true;

                saveButtonData.ID = "saveDetails";

                saveButtonData.Click += new ImageClickEventHandler(saveButtonData_Click);

                saveButtonData.AlternateText = "Save";

                saveButtonData.ImageUrl = umbraco.GlobalSettings.Path + "/images/editor/save.gif";

    I have tried all sorts of things and I just can't get the validators to operate either on the client side or the server side. Otherwise the form works fine.

    I have not been able to find mention of such a problem anywhere, so maybe I am doing something wrong, but I've been trying for days and I would really appreciate some help.

    I am using umbraco v 4.7.1 (Assembly version: 1.0.4281.20201).

    Thank you.

     

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Apr 08, 2012 @ 08:48
    Jeroen Breuer
    0

    It's possible to do validation, but I never tried it with client side validation in the Umbraco backoffice. If you make a textbox mandatory it also only checks validation server side. I created a package which uses server validation: http://our.umbraco.org/projects/backoffice-extensions/digibiz-email-form-with-tinymce. If you download the source on the source tab you can see how it's done.

    Jeroen

Please Sign in or register to post replies

Write your reply to:

Draft