defaut value from another rec

Questionsdefaut value from another rec
Massimo Gagliardi asked 6 years ago

I have a grid with values ​​of currency, payments at maturity, which may not exceed the amount of the invoice to which they relate.
Is it possible to read the total amount invoice (which is another record) and set this value as the default value the amount of the payment at maturity?
Thanks in advance

3 Answers
Abu Ghufran answered 6 years ago

If i understand the issue correctly. you will need to use on_data_display event handler and set the desired value to that column (after querying another record).

Refer demos/editing/custom-events.php for on_data_display usage.

Massimo Gagliardi answered 6 years ago

I would populate fields in the add/edit dialog not in the inline edit.
Is this possible?

Abu Ghufran answered 6 years ago

Answer is pretty late, but one solution could be to bind afterShowForm event with a JS function and do an ajax call to retrieve values.

$grid["add_options"]["afterShowForm"] = 'function(formid) {
// ajax call to load and fill data;
// set value in field using jQuery, usually field name will be ID of input tag e.g. set 123 in date field

In same way, you can connect:
$grid["edit_options"]["afterShowForm"] = '…';


Your Answer

14 + 12 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.

How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?