diff options
Diffstat (limited to 'views')
-rw-r--r-- | views/new-post.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/views/new-post.php b/views/new-post.php index 46be7a9..be5dafb 100644 --- a/views/new-post.php +++ b/views/new-post.php @@ -146,7 +146,10 @@ $(function(){ // If the user didn't enter any categories, add them from the post if(!userHasSetCategory) { - $("#note_category").val($("#note_content").val().match(/#[a-z0-9]+/g).map(function(tag){ return tag.replace('#',''); }).join(", ")); + var tags = $("#note_content").val().match(/#[a-z0-9]+/g); + if(tags) { + $("#note_category").val(tags.map(function(tag){ return tag.replace('#',''); }).join(", ")); + } } }); @@ -196,7 +199,9 @@ $(function(){ formData.append("location", v); } if(category.length > 0) { - formData.append("category", category); + for(var i in category) { + formData.append("category[]", category[i]); + } } if(syndications.length > 0) { formData.append("syndicate-to", syndications); |