Ich habe es nun umgeschrieben da es mit <?php echo $this->formId; ?> nicht geht
Ich nutze nun <?php echo $this->formID; ?> GROßES D
Dafür muss aber im Formulargenerator dem Form eine ID gegeben werden nicht Form-ID
Auch habe ich den Eintrag <?php echo $this->attributes; ?> raus genommen. Dafür kann dann aber keine Klasse mehr vergeben werden. Finde ich hier aber nicht so schlimm.
Hier der ganze geänderte Code
Code:
<!-- indexer::stop -->
<div class="<?php echo $this->class; ?> <?php echo $this->tableless ? 'tableless' : 'tableform'; ?> block"<?php echo $this->cssID; ?><?php if ($this->style): ?> style="<?php echo $this->style; ?>"<?php endif; ?>>
<?php if ($this->headline): ?>
<<?php echo $this->hl; ?>><?php echo $this->headline; ?></<?php echo $this->hl; ?>>
<?php endif; ?>
<form action="<?php echo $this->action; ?>" id="<?php echo $this->formID; ?>" method="<?php echo $this->method; ?>" enctype="<?php echo $this->enctype; ?>"<?php echo $this->novalidate; ?>>
<div class="formbody">
<?php if ($this->method != 'get'): ?>
<input type="hidden" name="FORM_SUBMIT" value="<?php echo $this->formSubmit; ?>">
<input type="hidden" name="REQUEST_TOKEN" value="{{request_token}}">
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $this->maxFileSize; ?>">
<?php endif; ?>
<?php echo $this->hidden; ?>
<?php if (!$this->tableless): ?>
<table>
<?php echo $this->fields; ?>
</table>
<?php else: echo $this->fields; endif; ?>
</div>
</form>
<?php if ($this->jquery): ?>
<script>
(function($) {
"use strict";
$(document).ready(function() {
var form = $('#<?= $this->formID; ?>');
form.submit(function() {
$.ajax({
type: '<?php echo strtoupper($this->method); ?>',
data: window.FormData ? new FormData(this) : form.serialize(),
cache: false,
contentType: false,
processData: false,
success: function(data) {
if (data == 'true') {
form.off('submit').submit();
return;
}
form.animate({'opacity':0}, 200, 'swing', function() {
form.html(data);
form.animate({'opacity':1}, 200);
try {
form.find('input,textarea').each(function (el) {
el.cleardefault();
});
} catch (err) {}
form.trigger('ajax_change');
$(window).trigger('ajax_change');
});
}
});
return false;
});
});
})(jQuery);
</script>
<?php elseif ($this->mootools): ?>
<script>
<?php if ($this->hasError): ?>
try {
window.scrollTo(null, (document.getElement('#<?php echo $this->formId; ?> p.error').getPosition().y - 20));
} catch(e) {}
<?php endif; ?>
window.addEvent('domready', function() {
document.id('<?php echo $this->formId; ?>').addEvent('submit', function(event) {
event.target.set('send', {
onComplete: function(txt, xml) {
if (txt == 'true') {
event.target.removeEvent('submit');
event.target.submit();
return;
}
new Fx.Tween(event.target, {property: 'opacity', duration: 200}).start(1,0).chain(function() {
this.element.set('html', txt);
this.start(0,1);
try {
this.element.getElements('input,textarea').cleardefault();
} catch (err) {}
this.element.fireEvent('ajax_change');
window.fireEvent('ajax_change');
this.callChain();
});
}
});
event.target.send('<?php echo \Environment::get('request'); ?>');
return false;
});
});
</script>
<?php endif; ?>
</div>
<!-- indexer::continue -->
Lesezeichen