Browse Source

API no longer produces 'no action specified' error when defaulting to form action

pull/1891/head
jlukic 9 years ago
parent
commit
5f9a1ab715
1 changed files with 12 additions and 6 deletions
  1. 18
      src/definitions/behaviors/api.js

18
src/definitions/behaviors/api.js

@ -162,9 +162,9 @@ $.api = $.fn.api = function(parameters) {
// exit conditions reached, missing url parameters
if( !url ) {
if($module.is('form')) {
module.debug('No url or action specified, defaulting to form action');
url = $module.attr('action');
if( module.is.form() ) {
url = $module.attr('action') || '';
module.debug('No url or action specified, defaulting to form action', url);
}
else {
module.error(error.missingURL, settings.action);
@ -212,6 +212,12 @@ $.api = $.fn.api = function(parameters) {
disabled: function() {
return ($module.filter(settings.filter).length > 0);
},
form: function() {
return $module.is('form');
},
input: function() {
return $module.is('input');
},
loading: function() {
return (module.request && module.request.state() == 'pending');
}
@ -508,10 +514,10 @@ $.api = $.fn.api = function(parameters) {
data = {}
;
if( !$.isWindow(element) ) {
if( $module.is('input') ) {
if( module.is.input() ) {
data.value = $module.val();
}
else if( $module.is('form') ) {
else if( !module.is.form() ) {
}
else {
@ -570,7 +576,7 @@ $.api = $.fn.api = function(parameters) {
url = settings.api[action];
module.debug('Found template url', url);
}
else {
else if( !module.is.form() ) {
module.error(error.missingAction, settings.action, settings.api);
}
}

Loading…
Cancel
Save