Skip to content

Commit

Permalink
fixes #2663 javascript errors on the host form
Browse files Browse the repository at this point in the history
  • Loading branch information
abenari authored and ohadlevy committed Jun 14, 2013
1 parent 1ff6a50 commit d592994
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions app/assets/javascripts/host_edit.js
Expand Up @@ -211,11 +211,13 @@ function load_puppet_class_parameters(item) {
function hostgroup_changed(element) {
var host_id = $("form").data('id');
var host_changed = $("form").data('type-changed');
if (host_changed ){
update_form(element,{data:"&host[id]="+host_id});
} else if (host_id) { // edit host
update_puppetclasses(element);
reload_host_params();
if (host_id) {
if (host_changed ){
update_form(element,{data:"&host[id]="+host_id});
} else { // edit host
update_puppetclasses(element);
reload_host_params();
}
} else { // a new host
update_form(element);
}
Expand All @@ -231,6 +233,7 @@ function location_changed(element) {


function update_form(element, options) {
options = options || {};
var url = $(element).data('url');
var data = $('form').serialize().replace('method=put', 'method=post');
if (options.data) data = data+options.data;
Expand Down

0 comments on commit d592994

Please sign in to comment.