I have a table with many values from a drop-down list (payment methods, types of document, vectors, seasons, …)
It may happen that when you are in the advanced editing of a new record we realize that a given value in a drop-down list is missing.
You need to let the update, go to the related table to add the missing value and, finally, back into the original table and restart the upgrade from the beginning.
I would like there was a button, next to the dropdown list, like the calendar widget, which can open a form to update the related table and back on the main form with the dropdown menu up to date.
Is it a dream?
Thanks for any suggestions
I think, the easiest solution would be to have a fixed value in dropdown: like
$str = $g->get_dropdown_values("select distinct client_id as k, name as v from clients");
$col["editoptions"] = array("value"=>":;-1:New Payment Method;".$str);
$col["editoptions"]["onchange"] = "function(o){ check_payment_dropdown(o); };
…
<script>
function check_payment_dropdown(o)
{
if (o.value == -1)
window.open('my-new-payment-method-form.php');
}
This would work when you have simple (non-dependent) dropdowns.
I think to a function in the add or edit dialog not in the inline edit.
It's possibile in the dialog?