contains a selectbox. When I change the option inside this selectbox,
another selectbox shows up with options generated from an .ajax() event.
Anyway... everything works fine, but when I submit the form CakePHP says:
404 Bad Request - URL was not found, but it DOES EXISTS 100%. I tested it
several times to be sure, but another thing is: When submit the form
WITHOUT selecting any option from the first selectbox the form is submitted
correctly. I dont know what to post really but here is my Javascript:
$('select[data-onchange=true]').live("change", function() {
var _this = $(this);
var element = $('select[data-onchange-trigger=' + _this.attr("id")
+ ']:first');
if (typeof element == "object") {
if (_this.attr("data-onchange-load")) {
var options = element.prop("options");
var load = _this.attr("data-onchange-load");
$.ajax({
dataType: "json",
url: load + _this.find('option:selected').val(),
beforeSend: function() {
$('.ajax-loader').show();
element.find('option').remove();
element.parent().hide();
},
success: function(data) {
$.each(data, function(index, _data) {
if (typeof _data == "object") {
$.each(_data, function(index, _data) {
options[options.length] = new
Option(_data.name, _data.id);
});
}
});
element.parent().show();
},
complete: function() {
$('.ajax-loader').hide();
}
});
}
}
});
The error occurs only when I submit the form after I change the option onvar element = $('select[data-onchange-trigger=' + _this.attr("id")
+ ']:first');
if (typeof element == "object") {
if (_this.attr("data-onchange-load")) {
var options = element.prop("options");
var load = _this.attr("data-onchange-load");
$.ajax({
dataType: "json",
url: load + _this.find('option:selected').val(),
beforeSend: function() {
$('.ajax-loader').show();
element.find('option').remove();
element.parent().hide();
},
success: function(data) {
$.each(data, function(index, _data) {
if (typeof _data == "object") {
$.each(_data, function(index, _data) {
options[options.length] = new
Option(_data.name, _data.id);
});
}
});
element.parent().show();
},
complete: function() {
$('.ajax-loader').hide();
}
});
}
}
});
the selectbox.
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.