Hi,
since I still haven’t figured out how to make it work I’m going to post a more extensive description of what I’m doing.
I have a form in a normal template that looks like this:
<form id="myform" action="{path="signup/_processor"}" method="post" accept-charset="{charset}">
Name:
<input id="name" name="name" type="text" value="" />
<input name="submit" type="image" src="#" alt="Submit" />
</form>
and I have a small javascript (and the mootools.net library) to validate the field via AJAX:
//<![CDATA[
window.addEvent('domready', function() {
$('myform').addEvent('submit', function(e) {
new Event(e).stop();
var log = $('log').empty().addClass('ajax-loading');
this.send( {
update: log,
onComplete: function() {
log.removeClass('ajax-loading');
}
});
});
});
//]]>
and my _processor template looks like this (not the full template beacuse I know the script works fine):
<?php
include('{path="signup/_functions"}');
//Check user language.
$language = $_POST['language'];
// Check if name is available.
if ($_POST['name'] == '') {
if ($language == 'en') {
$errors[] = "Name is required.";
}
else {
$errors[] = "ES:Name is required.";
}
}
Now the funny thing is if I remove the “_” (my indicator for hidden templates) from my _processor template and I comment out the javascript in my header (the one to call up the AJAX validation) it works just fine. A new page opens with just the errors. As soon as I put in the AJAX again it doesn´t work. Why can this be?