ReadOnly Field with Autofill

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
fhkvf
User
Posts: 23

ReadOnly Field with Autofill

Post by fhkvf »

On some tables i use fields with "ReadOnly" ($this->product->ReadOnly = true;) and autofill.
However, since version 2024 this no longer seems to work for destination fields.

ReadOnly configuration works, but not in combination with autofill on the destination.
At the html i see only <input ... data-readonly="1" ...> but not readonly=1. Is there something special with v2024?

As Workaround i use Client Script $("#x_product").prop("readonly", true).


measan
User
Posts: 33

Post by measan »

try this code on clientscript :

$("#x_product").attr("readonly", "readonly");


measan
User
Posts: 33

Post by measan »

if you want autofill just do

Select field and then click Use lookup table - fill table name and link field and click Display Field and then click Autofill set True and click option and set field in there with Auto Fill.


fhkvf
User
Posts: 23

Post by fhkvf »

Thank you measan. My workaround works also.

But i want to use it, in same way as before v2024 with $this->myFieldName->ReadOnly = true; for fields with autofill and without.
I would like to keep the config homogeneous as before.


mobhar
User
Posts: 11727

Post by mobhar »

In which server event did you put that $this->myFieldName->ReadOnly = true; code?


fhkvf
User
Posts: 23

Post by fhkvf »

Normaly i use Page_Load(), and try Page_Render() with same result.


mobhar
User
Posts: 11727

Post by mobhar »

Try Row_Rendered server event.


fhkvf
User
Posts: 23

Post by fhkvf »

Mhh.
I tried Table-Specific -> Common -> Row_Rendered, but it does not work.
i can use the input field as it is and can type any chars... there is no readonly="1" within input tag as other none autofill destination fields.

function Row_Rendered() {
	//simple test
	$this->product->ReadOnly = true;
}

Result:

<input type="text" name="x_product" id="x_product" data-table="order" data-field="x_product" value="" data-page="1" maxlength="100" placeholder="" data-format-pattern="" class="form-control disabled" data-readonly="1" aria-describedby="x_product_help">

hakanari
User
Posts: 1

Post by hakanari »

Version 2024, ReadOnly does not work on Select and Multiselect Fields. The others are ok. Is there any solution to solve this problem?

    if (condition) {
        $this->text_field->ReadOnly = true; //Works
        $this->select_field->ReadOnly = true; //Does not work!
        $this->multiselect_field->ReadOnly = true; //Does not work!
    }

arbei
User
Posts: 9384

Post by arbei »

Note that readonly attribute is for text input only, you may use Disabled property instead.


Post Reply