This topic is locked
[SOLVED]

 strange Javascript behavior

4/30/2020 12:51:02 AM
PHPRunner General questions
K
keithh0427 author

I have two fields on the Edit page that are sitting in a Tab.
I have this code in my Javascript OnLoad event for the Edit page.
var ctrl = Runner.getControl(pageid, 'homeRegionID');

ctrl.setDisabled();
var ctrl = Runner.getControl(pageid, 'homeEncounterID');

ctrl.setDisabled();
But, they're not disabled. I also tried makeReadonly(), but the results were the same.
I can edit the two fields whether I define them as makeReadonly or setDisabled(). The dropdown boxes for the fields still give me all of the selections.
This should be simple (and probably is), but I cannot see where I've done anything wrong. Do I need to define the tab and make that tab active to access the fields?
I am hoping someone can set me straight.

M
Mark Kramer 4/30/2020



I have two fields on the Edit page that are sitting in a Tab.
I have this code in my Javascript OnLoad event for the Edit page.
var ctrl = Runner.getControl(pageid, 'homeRegionID');

ctrl.setDisabled();
var ctrl = Runner.getControl(pageid, 'homeEncounterID');

ctrl.setDisabled();
But, they're not disabled. I also tried makeReadonly(), but the results were the same.
I can edit the two fields whether I define them as makeReadonly or setDisabled(). The dropdown boxes for the fields still give me all of the selections.
This should be simple (and probably is), but I cannot see where I've done anything wrong. Do I need to define the tab and make that tab active to access the fields?
You are setting two different fields to the same "varable" "ctrl". If you want to change the second one to "ctrl1" you will have more consistant ressults.
var = Runner.getControl(pageid, 'homeRegionID');

ctrl.setDisabled();
var [color="#8B0000"]ctrl1= Runner.getControl(pageid, 'homeEncounterID');

ctrl.setDisabled();

M
Mark Kramer 4/30/2020



I have two fields on the Edit page that are sitting in a Tab.
I have this code in my Javascript OnLoad event for the Edit page.
var ctrl = Runner.getControl(pageid, 'homeRegionID');

ctrl.setDisabled();
var ctrl = Runner.getControl(pageid, 'homeEncounterID');

ctrl.setDisabled();
But, they're not disabled. I also tried makeReadonly(), but the results were the same.
I can edit the two fields whether I define them as makeReadonly or setDisabled(). The dropdown boxes for the fields still give me all of the selections.
This should be simple (and probably is), but I cannot see where I've done anything wrong. Do I need to define the tab and make that tab active to access the fields?
I am hoping someone can set me straight.


var ctrl = Runner.getControl(pageid, 'homeRegionID');

ctrl.setDisabled();
var ctrl1 = Runner.getControl(pageid, 'homeEncounterID');

ctrl.setDisabled();

K
keithh0427 author 4/30/2020

Turns out that I had a field on the page that I removed and forgot to remove the javascript that went with it. Removed the code in the OnLoad event and all is well now.
Thanks for your response.

M
Mark Kramer 4/30/2020



Turns out that I had a field on the page that I removed and forgot to remove the javascript that went with it. Removed the code in the OnLoad event and all is well now.
Thanks for your response.


Cool. I find most of the time my errors are an over site on my part from trying to get that last bit of code to work at 3:30 am after working all day. Brain is fried..
Do you use the f12 (developer tools) in your browser? It is life saver for Jscript errors.