This topic is locked

Adding a record and making another conditional field read-only on the Edit Page.

7/11/2021 11:24:04 AM
PHPRunner General questions
M
muammer author

Hello, please help.
I have a table where Cash Cash transactions are kept.
The fields in my table are; date field, cash transaction type field, description field, receipt amount field and output amount field.
It should work on add and edit pages.
According to the input and output type of the cash transaction, I want the output amount field to be readable only when input is selected from the drop-down list, and the input amount field to be read only when output is selected from the drop-down list.
Thank you very much if you can help the above process step by step with sample codes.

img alt

admin 7/12/2021

Hope it helps:
How to make a field readonly

M
muammer author 7/12/2021

Dear admin, thank you very much for your suggestion, I looked according to the guide in the link you gave, but unfortunately it did not work.
Add page to my table "javascript onload event" I am writing the following code. But the field I want is not "readonly".
Can you tell me what I'm doing wrong? How should the sample correct code be? you are helpful

if ( $data['Kasa_Hareketi'] == "GİRİŞ"){
var ctrl = Runner.getControl(pageid, 'Cikis_Tutari');
ctrl.makeReadonly();
}else{
var ctrl = Runner.getControl(pageid, 'Cikis_Tutari');
ctrl.makeReadWrite();

}
admin 7/12/2021

You are mixing PHP and Javascript code and it will not work this way.

Learn how to pass data from PHP to Javascript.