using editor field value as an external variable in a select
using editor field value as an external variable in a select
i am setting up a returns form whereby i want to ensure the select field will have a maximum value of the original order quantity.
using the example on page https://editor.datatables.net/manual/php/joins#Options as a starting point
Field::inst( 'users.site' )
->options( Options::inst()
->table( 'sites' )
->value( 'id' )
->label( 'name' )
->where( function ($q) {
$q->where( 'name', 'L%', 'LIKE' );
}
);
instead of the Like L%, I want to set my 'where' parameter using the value from a different editor field value, tblorderdetails.Quantity
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I think the problem you might run into there is that for each row the maximum value might be different. That might or might not be true in your data set, but it sounds like something that might be specific to the row that is being edited.
If that is the case you would need to use
initEdit
to get the information from the server based on the row being edited and populate the options.Allan
yes, that makes sense.
so, basically, i retrieve the value originally ordered from my editor instance and use this as a parameter ?
this is what I have done, and it seems to work...
That looks spot on to me - nice one!
Allan