Page 1 of 1

How to make text box readonly

Posted: Fri Mar 24, 2023 2:18 am
by ufone

I did it and check only read but but still able to write.
thanks


Re: How to make text box readonly

Posted: Fri Mar 24, 2023 8:50 am
by mobhar

Please note if you enable ReadOnly option under Fields setup -> Edit Page, then it will only affect to Edit Page.

In Add/Copy Page, the Textbox is still writable. If you want to make it Read Only for Add/Copy then you may put this code in Row_Rendered server event:

if (CurrentPageID() == "add") 
    $this->YourFiledName->ReadOnly = true; // adjust YourFieldName to your actual field name

However, sometimes you need to define the default value for that field even you set ReadOnly to it. So, you may need this code in Row_Inserting server event:

// adjust YourFieldName to your actual field name
$rsnew["YourFieldName"] = "your default value"; // <-- adjust to your needs

Re: How to make text box readonly

Posted: Mon Apr 10, 2023 12:59 pm
by ufone

thanks your helpful reply