terminal42 / contao-ajaxform

Submit a form through ajax and display error or confirmation message.
15 stars 7 forks source link

Page skips to top #11

Closed bennie99 closed 6 years ago

bennie99 commented 6 years ago

As reported in this thread the page jumps to top when you have sent the form and the confirmation is shown. This behaviour is not what we expected because holding the form in place is the reason we like to use ajaxform That wasn't the case in Contao 3.5

mhsolutions commented 6 years ago

In Contao 4.4 (maybe also in other versions) you need to edit the ajaxform.html-Template. Apparently in Contao 4.4 there is no 'formId' anymore so what I did was to edit these lines:

From: id="<?php echo $this->formId; To: id="<?php echo $this->formSubmit;

Also in the jQuery Section you need to change these lines:

From: var form = $('#<?php echo $this->formId; ?>'); To: var form = $('#<?php echo $this->formSubmit; ?>');

Same goes for the mootools-Section.