How to make text box readonly

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

How to make text box readonly

Post by ufone »

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


mobhar
User
Posts: 11660

Post 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

ufone
User
Posts: 51

Post by ufone »

thanks your helpful reply


Post Reply