This project is read-only.

Server side validation

Jun 13, 2010 at 10:29 AM

Firstly thank you for releasing this to the comunity, it's a great module and is something I've been wanting to implement myself for a long time. The potential of xslt is very under rated in my opinion. I'm keen to put it to use but I've got a specific probem.

Our design standards frequently require that server side validation be working if javascript isn't active on the browser. I've looked around in the source and found a way to implement working validators using the aspnet-control tag. However I can't find a way to determine if the validation has been succesful or not before executing an sql command using the method shown in the database concepts example you kindly provided. I've tested against page.isvalid but one of the problems is that the validation hasn't been fired at the time the xslt is processed. Do you have any suggestions about using server side validation when javascript is inactive with your module?

Jun 13, 2010 at 2:19 PM

Thank you very much for the message.

aspnet-control tag is obsolete. This idea came to me at night and make me ashamed of myself in the morning...

Now I'm working on the convinient model that allows using ASP.NET (including Telerik) controls. Actually in 01.01.23 I provide 2 stages for the ASP.NET processing

  1. Page load section. This section is for ASP.NET controls structure creation. This is default section.
  2. Prerender section. This section is marked with <mdo:pre-render/> tag and processed in OnPreRender(EventArgs e) method of the page.

You can review a short sample of how ASP.NET controls can be used.

For your task you can do the following

  <!-- your controls go here -->
  <xsl:if test="mdo:aspnet('Page.IsValid')">
    <!-- put your database access code here -->

I'm preparing now a cptcha sample, I'll notify you when be done.

I appreciate any feedback and provide a free limited support for users of XsltDb. I believe that working with XsltDb's users make it really useful for building realworld sites. 


Jun 13, 2010 at 2:47 PM

Previous post is very laconic, this is a working sample:

<mdo:asp xmlns:asp="asp">
  <asp:Label runat="server" ID="label" />
  <!-- your controls go here -->
  <xsl:if test="mdo:issubmit()">
    <xsl:if test="mdo:aspnet('Page.IsValid')">
      xsl:if test="mdo:assign('#label.Text', 'Page Is Valid')" />
      <!-- put your database access code here -->

<button>Submit page</button>


Jun 15, 2010 at 10:06 AM

Thanks for this findy. I don't have time to go into depth with it now, but when I quickly copied it the pre-render part of the example doesn't seem to do anything. I am using the latest version.

Well done for the inclusion of edit area for editing the xsl as well.

Jun 15, 2010 at 6:54 PM

This is just a valid structure, it output a button that submits a page and on submit Page.Isvalid is called and if page is valid it outputs a "Page Is valid" Message. Wait for the sample with captcha that will show in details exactly what you want - server side validation through Page.IsValid.

Jun 16, 2010 at 1:00 PM


As I see now the problem is that the line where 'Page Is Valid' is prinring should start with '<'. But it doesn't...

Here is one more sample with validator and 

<mdo:asp xmlns:asp="asp">
  Required field: <asp:textbox id="textbox1" runat="server"/>
  <asp:RequiredFieldValidator id="valRequired" runat="server" ControlToValidate="textbox1"
    ErrorMessage="* You must enter a value into textbox1" Display="dynamic">* Required
  Nullable field: <asp:textbox id="textbox2" runat="server"/><br/>
  <asp:Label ID="result" runat="server" ForeColor="red" /><br/>

<button>Submit Form</button>

  <xsl:if test="mdo:is-submit()">
      <xsl:when test="mdo:aspnet('Page.IsValid')">
        <!-- Your database code goes here -->
        <xsl:execute select="mdo:assign('#result.Text', 'OK')" />
        <xsl:execute select="mdo:assign('#result.Text', 'Fill required fields')" />

to access textbox values you can use mdo:aspnet('#textbox1.Text') and mdo:aspnet('#textbox2.Text').

This sample requires 01.01.27 version of XsltDb or higher!


Jun 16, 2010 at 6:19 PM

That's brilliant, thanks.

Jun 24, 2010 at 10:02 PM

Captcha demo is prepared.

Telerik RadCaptcha, DotNetNuke CaptchaControl, reCaptcha online service are covered. Please, review:

To play with captcha you need to upgrade to 01.01.35 or newer.