ID Field Change

QuestionsID Field Change
Benjamin asked 10 years ago

Hi,

I have a field (an ID) displayed in the list and not editable. That's fine.
But, I need it to appear in the Add form … it doesn't even if I put "add"=>true in $col["show"] … need help.

$col = array();
$col["title"] = "Code";
$col["name"] = "glf_code";
$col["width"] = "40";
//$col["editable"] = true;
$col["show"] = array("list"=>true, "add"=>true, "edit"=>false, "view"=>true);
$col["editrules"] = array("custom"=>true,
"custom_func"=>"function(val,label){return my_validation(val,label);}");
$cols[] = $col;

Thanks,

6 Answers
Abu Ghufran answered 10 years ago

You must set $col["editable"] = true; to get this behavior.
It won't show in edit so will not be editable but it is required for add dialog.

Benjamin answered 10 years ago

Hi Abu,

If I set $col["editable"] = true; the field is shown and editable in the line … I do not want it to be editable in the line.

It is shown in the Add form … that's fine.
It is not shown so not editable in the Edit form … that's also fine.

Thanks,

Abu Ghufran answered 10 years ago

Hello,

To remove from listing, set:
$col["show"]["list"]=false;

Benjamin answered 10 years ago

Hi,

Yes, this … $col["show"]["list"]=false; will remove from listing. I'd like to see it.

For me, this field is a kind of User ID. It can be entered (only in Add form) but once created, it is shown (in the list and in the Form) but not editable.

Is that possible ?
Thanks

Abu Ghufran answered 10 years ago

I'll regenerate the case and will update you.

Abu Ghufran answered 10 years ago

Try setting:
$col["editrules"]["readonly"] = true;

If your column is not autoincrement, you need to ste autoid = false for first column so it may
get inesrted in insert sql.

Complete column definition would be:

$col = array();
$col["title"] = "Id";
$col["name"] = "client_id";
$col["width"] = "20";
$col["autoid"] = true;
$col["editrules"]["readonly"] = true;
$cols[] = $col;

Your Answer

3 + 16 =

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?