Added feature to ENUM/SET editor where users can add more than one new field at a time
This commit is contained in:
@@ -1802,22 +1802,27 @@ $(document).ready(function() {
|
|||||||
disable_popup();
|
disable_popup();
|
||||||
});
|
});
|
||||||
|
|
||||||
// If the "add value" link is clicked, insert another text box
|
// When the submit button is clicked, put the data back into the original form if
|
||||||
$("a[class='add_value']").click(function() {
|
// the "add x more values" checkbox is not checked. Otherwise, just insert x more
|
||||||
$("#enum_editor #values").append("<input type='text' />");
|
// textboxes
|
||||||
});
|
|
||||||
|
|
||||||
// When the submit button is clicked, put the data back into the original form
|
|
||||||
$("#enum_editor input[type='submit']").click(function() {
|
$("#enum_editor input[type='submit']").click(function() {
|
||||||
var value_array = new Array();
|
if($("input[type='checkbox'][name='add_extra_fields']").attr("checked")) {
|
||||||
$.each($("#enum_editor #values input"), function(index, input_element) {
|
for(i = 0; i < $("input[type='text'][name='extra_fields']").attr("value"); i++) {
|
||||||
val = jQuery.trim(input_element.value);
|
$("#enum_editor #values").append("<input type='text' />");
|
||||||
if(val != "") {
|
|
||||||
value_array.push("'" + val + "'");
|
|
||||||
}
|
}
|
||||||
});
|
// Uncheck it
|
||||||
var values_id = $("#enum_editor input[type='hidden']").attr("value");
|
$("input[type='checkbox'][name='add_extra_fields']").removeAttr("checked");
|
||||||
$("input[id='" + values_id + "']").attr("value", value_array.join(","));
|
} else {
|
||||||
disable_popup();
|
var value_array = new Array();
|
||||||
|
$.each($("#enum_editor #values input"), function(index, input_element) {
|
||||||
|
val = jQuery.trim(input_element.value);
|
||||||
|
if(val != "") {
|
||||||
|
value_array.push("'" + val + "'");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var values_id = $("#enum_editor input[type='hidden']").attr("value");
|
||||||
|
$("input[id='" + values_id + "']").attr("value", value_array.join(","));
|
||||||
|
disable_popup();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user