Problem with readonly-when

QuestionsProblem with readonly-when
mofel asked 3 years ago

Hi Abu,

I just spent few hours on this and i can't understand where i make wrong …

I have a problem with the feature "readonly-when".

My field is the following:

$col = array();
$col["title"] = "Description"; // caption of column
$col["name"] = "description";
$col["align"] = "center";
$col["editable"] = True;
$col["editrules"] = array("required"=>true, "readonly"=>true, "readonly-when"=>"check_invoice");
$col["show"] = array("list"=>true, "add"=>true, "edit"=>true, "view"=>true);

$cols[] = $col;

The JS function check_invoice:

function check_invoice(formid)
{

invoice_id = jQuery("input[name=invoice_id]:last, select[name=invoice_id]:last",formid).val();

alert(invoice_id);
console.log(formid);
return true;
}

The key of the grid invoice_id.
The alert is alway returning undefined.

I tried to log the formid object but i'm not sure about the what i should have.

Right now i have this:
https://pastebin.com/fEdSvf1V

Can you give any suggestion on where can i search for my problem ?

Thanks
Mofel

3 Answers
Abu Ghufran answered 3 years ago

Pastebin link code is not displaying correctly.
Please refer code column-access.php line 67 for usage.

You can email me at [email protected]

mofel answered 3 years ago

Hi Abu,

I just sent you an email … i'm becoming crazy with this !

Thanks
Mofel

mofel answered 3 years ago

Thanks Abu for answering by email.

For other person that have the same problem … the id must be:
editable = true

Your Answer

2 + 11 =

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?