Params when not using ajax

Oct 4, 2010 at 1:12 PM

Hi Anton,

while working on a simple radchart integration, I found the chart does not get updated if I use ajax calls, while it works perfectly if I don't. Regardless of this specific problem (maybe there's a way to let radchart work under ajax also), I was wondering whether (how) it's possible to deal with form parameters without using ajax.

That is, I want my form to reload the page passing querystring parameters. So I have an mdo:navigate call:

<a href="{mdo:navigate('$action', 'search', '$pdatada', mdo:request('datada'), '$pdataa', mdo:request('dataa'))}">SEARCH</a>



The problem is that mdo:request calls only get a value when I specify mdo:ajax on the input fields: so I have code like this to keep track of last param value choosen, both if it comes from the ajax onchange call or from the navigate function:


<xsl:variable name="dda">
                            <xsl:when test="mdo:request('datada')!=''">{{mdo:request('datada')}}</xsl:when>
                            <xsl:when test="mdo:param('$pdatada')!=''">{{mdo:param('$pdatada')}}</xsl:when>
DATE FROM:<input type="text" id="datada" name="datada" onchange="{mdo:ajax()}" value="{$dda}"></input>


But those mdo:ajax calls are destroying my form, which I make pretty with some js in  jQuery(document).ready:


jQuery("#datada").datepicker({ showStatus: true, showOn: 'button', buttonImage: '/images/calendar.png',  buttonImageOnly: false, initStatus: 'Data Inizio', yearRange: '2000:<xsl:value-of select="user:CurrentYear()"></xsl:value-of>' } );



That is: first time, after a normal page-load, form is well built, but if I change the input value after submitting the form once, that mdo:ajax causes a postback and my function does not get called anymore. But If I omit the mdo:ajax I never can get values for the input field.

I certainly am missing something obvious, but... how could I correct this form not to use mdo:ajax?






Oct 6, 2010 at 10:13 PM


I solved the strange problem with form being "destroyed" - loosing dynamically loaded aspect, see datepicker, after mdo:ajax calls.

Once again a "noajax" magic: I included in a noajax tag all my declarations for external css and js scripts, and all begun working.

Maybe there's some weird function being called in those js files, but this lead me anyway to a couple of considerations:

  • including css and javascript files should better be done at page level, externally or maybe by mdo:asp calls: how do you usually do this?
  • if using static (html link and script tags inline) declarations, better to include them in a "noajax" tag: do you agree?


Dec 12, 2010 at 7:29 AM


I use some technics to build a realiable code with an attractive appearance.

  • When I have something (js, css) static I include in on page or portal level of course. If something is almost static I always try to extract maximum static part and just make some setup of it inside module. In case of javascript I create a js file that depends on some global variables. And define values of variables inside my module. Or I use classes and pass parameters when instantiating objects.
  • When I implementing forms I try using client-server approach instead of classic page request/response. I use <mdo:callable/> to implement server-side logics and <mdo:service/> to load forms. In this case I can avoid using mdo:ajax that rebuild all HTML of module. But if I still use mdo:ajax I suer put all form definition in static <noajax> zone.
  • I always keep in mind that XsltDb is an integration module so I use ASP.NET to implement sophisticated logics and then use XsltDb to put all together.
  • XsltDb is ideal tool to deal with pure javascript libraries like extJS, so I use those instead ASP.NET when possible.
  • I don't use mdo:navigate :-)
  • When I need to pass values from XSLT to JS I first put them into HTML:
          <span some-var="{$some-var}"/>
          var someVar = $("span[some-var]").attr("some-var");
    Or there is another way:
          var someVar = {{mdo:js-encode($some-var)}}


Dec 17, 2010 at 12:26 PM


thank you so much for sharing such precious info.

For the inclusion of static resources, css and js files, I adopted another method: I make calls to RegisterClientScriptBlock from a custom mdo method (see for example my XSLideShow XsltDb 
module at 
I find this way to be good, since it allows you to include what you need directly from within your xslt, instead of at page or portal level. The result should be the same, since RegisterClientScriptBlock  
avoids duplicate registrations.

I also wish to thank you for the great work on the new release: I'll soon try to convert my templates to use the new thumbnail generation/image handling functions.

I didn't check yet, but at first sight there are only a couple of things missing: generating square (cropped) or fixed-size thumbnails, and generating thumbnails for any image (to be loaded from an URL
instead of from a local file). If that's true, I have some code I wrote for XSLideShow that you could (correct and) integrate ;)