Skip to content

Commit

Permalink
Merge pull request mobz#15 from ClementNotin/master
Browse files Browse the repository at this point in the history
provide default body to anyRequest
  • Loading branch information
mobz committed Jun 9, 2011
2 parents 9727ab2 + f6009b1 commit 4895385
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/es/widgets.js
Expand Up @@ -477,8 +477,16 @@
this.prevData = data;
},
_validateJson_handler: function(jEv) {
try {
var j = JSON.parse(this.dataEl.val().trim());
/* if the textarea is empty, we replace its value by an empty JSON object : "{}" and the request goes on as usual */
var jsonData = this.dataEl.val().trim();
if (jsonData == "")
{
jsonData = "{}";
this.dataEl[0].value = jsonData;
}

try {
var j = JSON.parse(jsonData);
} catch(e) {
this.errEl.text(e.message);
return false;
Expand Down

0 comments on commit 4895385

Please sign in to comment.