This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* @param unknown_type $form | |
* @param unknown_type $form_state | |
* @return multitype:string NULL | |
*/ | |
function multifiles_example_form($form, &$form_state) { | |
$form['#tree'] = TRUE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* @param unknown_type $form | |
* @param unknown_type $form_state | |
* @return multitype:string NULL | |
*/ | |
function multifiles_example_form($form, &$form_state) { | |
$form['#tree'] = TRUE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* jquery.ajaxSubmit.js - v 0.9.3 (2011-11-29) | |
* Copyright (C) 2011 by Adam Ydenius ([email protected]) | http://mollwe.se | |
* Dual licensed under MIT and GPL. | |
*//* | |
* Gets all input (with name attribute) values within form and submits form with ajax. | |
* First argument, options, is object with: | |
* Properties: | |
* - url: override form action. | |
* - method: override form method. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ Form::open(['data-remote', 'data-remote-success-message' => 'I have now done the thing.']) }} | |
{{ Form::text('name') }} | |
{{ Form::submit('Submit', ['data-confirm' => 'Are you sure?']) }} | |
{{ Form::close() }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @var array $scriptProperties | |
* @var AjaxForm $AjaxForm | |
*/ | |
$AjaxForm = $modx->getService('ajaxform', 'AjaxForm', $modx->getOption('ajaxform_core_path', null, $modx->getOption('core_path') . 'components/ajaxform/') . 'model/ajaxform/', $scriptProperties); | |
if (!($AjaxForm instanceof AjaxForm)) { | |
return ''; | |
} | |
$AjaxForm->initialize($modx->context->key); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
var xhr, $form = $('form'); | |
function getResponse(data){ | |
console.log(data); | |
} | |
function postForm(){ | |
return $.ajax({ | |
'dataType' : "jsonp", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create a new dbStore stack | |
var myStack = localStack('myLocalStack'); | |
function onFormSubmit(){ | |
// push form data into local storage | |
myStack.push( $('form').serializeArray() ); | |
// see if we can send data to the server | |
checkForConnection(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#thing form').submit(function(e) { | |
var $this = $(this); | |
e.preventDefault(); | |
$.ajax({ | |
type: this.method, | |
dataType: "JSON", | |
url: this.action, | |
data: $this.serialize(), | |
success: function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function() { | |
var form = $('#form'); // contact form | |
// form submit event |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function AjaxForm() { | |
$("form.ajaxform").submit( | |
function(e) { | |
e.preventDefault(); | |
var dataString = $(this).serialize(); | |
var method = this.method.toUpperCase(); | |
var action = this.action; | |
$.ajax({ | |
type: method, | |
url: action, |