This project is read-only.

form to external dll

Jan 21, 2011 at 9:37 AM


New question :) how do i get form values to a external dll.

The external dll part is working thanks to the example here:


Jan 21, 2011 at 11:14 AM


As far as you are in the web context you have access to Request object. If your page was submitted you can use it as follows:

If you mean using form values inside DLL:

  1. Add reference to System.Web in your DLL project
  2. Use System.Web.HttpContext.Current.Request["inputName"] to access form values inside DLL.

If you just want to send values as parameters you can use mdo:request('inputName'). Here is a simple example.

<msxsl:script language="C#" implements-prefix="script">
   public int someFunc(string fieldValue)
        return fieldValue.Length;

<xsl:template match="/">
  <!-- Emulate stateful control -->
  <input name="inputName" type="text" value="{mdo:request('inputName')}"/>
  <button>Calculate Length</button>


Jan 21, 2011 at 1:14 PM

If I want to have a page with the form and a page for the processing. Are there 2 modules required or is it possible in one xsltdb module?

Jan 21, 2011 at 1:31 PM


you could use an mdo:service section (which is actually a separate template) to simulate the second page, calling it from the main template (where you get the url via mdo:service-url()) with ajax calls.

For example I use this approach in XSLider and XSLideShow, two xsltdb modules I'm developing: you might look at my code, which is absolutely not perfect but maybe can be useful for you.

If you don't want to use ajax, you might use xsl:choose to divide your template in sections, for example "view" and "save", to be loaded when needed. You can find something like this also, in my templates.


Jan 21, 2011 at 1:32 PM

One module is quite enough

Jan 21, 2011 at 1:49 PM

... accidentally submited uncompleted...

The main question here is how are you going to send form to another page? I know a few ways

  • Changing action attribute of a form (affects browser's addres line)
  • Transferring request to another page (does not affect browser's addres line)
  • Post form using AJAX or process results using special javascript call (doesn't affect browser's window content), you can manually inject results in current HTML.

What is your one?

XsltDb supports all of those methods.


Jan 25, 2011 at 7:23 AM

Is there a example (because the form documentation is missing) of a page with a form and submitting it to a next page?

Jan 25, 2011 at 9:01 AM

I have no such sample at the moment.

I could create one for you but I must understand the nature of the requirement to process form values on page other than form's page.

If you are implementing a WIZARD - you better process form on the form's page. If everything is successfull - just redirect to next page with mdo:redirect(url) function:

<xsl:if test="mdo:param('@cmd') = 'save'">

   <!-- Here goes a code that saves fields somehow -->

   <!-- After that, just redirect user to next page-->
   <xsl:execute select="mdo:redirect('/next_page_relative_url.aspx')" />


<!-- The forn itself -->
Field One: <input name="field-1" /><br/>
Field Two: <input name="field-1" /><br/>
<a class="CommandButton" href="{mdo:submit('@cmd', 'save')}">Next &gt;&gt;</a><br/>

If it is not your case - whet is your one then?

Feb 9, 2011 at 11:52 AM

How can i merge this with captha example?

Feb 9, 2011 at 8:36 PM

You have 2 options here:

1. If you are using reCAPTCHA you can validate it client-side. So you can add a validator to mdo:submit () and check CAPTCHA using ajax (

2. If you are using telerik CAPTCHA you need to create mdo:pre-render region as you have to call mdo:page-validate() that works only in.

Here is a complex sampl with jquery validation and Telerik CAPTCHA.


<style type="text/css">
  .error { color: red; }

<script type="text/javascript" 
  src="" />
<script type="text/javascript">
  function validateForm() {
    return $("form").validate().form();

<div>Name: <input name="name" class="required" value="{mdo:form('name')}" /></div>
<div>E-Mail: <input name="email" class="required email" value="{mdo:form('email')}" /></div>
<mdo:asp xmlns:telerik="telerik">
  <telerik:RadCaptcha runat="server" ID="captcha" ErrorMessage="Captcha not solved" />

<a href="{mdo:jsubmit('validateForm', '@action', 'save')}">Save</a>

  <xsl:if test="mdo:param('@action')='save'">
    <xsl:execute select="mdo:page-validate()"/>
    <xsl:if test="mdo:aspnet('#captcha.IsValid')">
      <!-- process form and redirect to next page -->