AJAX Form submission question


#1

**Matrix Version:**5.3.4.2
Hi,

I am just new to squiz matrix and is that possible to use AJAX to submit a form? I tried to submit a from through ajax, nothing went through the submission log and the returning data was a html page. Is there any related reading resources or tutorials about submit form through AJAX in squiz matrix? Much appreciated.


(John gill) #2

The most common explanation is that Matrix forms require the value that is sent by the submit button, but if you submit the form with JS instead of the button that value isn’t sent.

e.g

<input name="form_email_279_submit" value="Submit" class="sq-form-submit" id="form_email_279_submit" type="submit">

Typically I just convert the button to a hidden field before submission. Alternatively, if you’re building your AJAX payload manually, just be sure to include the form_email_<assetid>_Submit / Submit field.


#4

Thanks mate, it helps a lot!