...

View Full Version : make certain fields readonly and unselectable on event



Drieske1982
03-12-2004, 03:03 PM
Hi,

Still working on http://www.aendekerk.be/beta/airco/bereken.html
Is it possible to make certain fields readonly and unselectable when another field has a certain value?

This is what i want:
* When b1x1_tot_view or b1x2_tot_view does NOT contain an X, make b3x1_x3, b3x2_x3, b3x3_x3 and b3x4_x3 readonly, unselectable, reset to zero and the background of this field should be gray.

* When b1x3_tot_view does NOT contain an X, make b3x1_x1, b3x2_x1, b3x3_x1, b3x4_x1, b3x1_x2, b3x2_x2, b3x3_x2 and b3x4_x2 readonly, unselectable, reset to zero and the background of this field should be gray.

* When b1x4_tot_view does NOT contain an X, make b3x1_x2, b3x2_x2, b3x3_x2, b3x4_x2, b3x1_x3, b3x2_x3, b3x3_x3 and b3x4_x3 readonly, unselectable, reset to zero and the background of this field should be gray.

With readonly and unselectable, i mean something like:
<input type="text" name="b3x1_x2" size="1" readonly unselectable>

Willy Duitt
03-12-2004, 03:32 PM
It would be much more appropriate if you kept these continual changes to one thread. As it is now. This script is scattered amongst 3-5 threads and it would be easier for someone to modify the script that validated the has X's which was provided for you than to visit your page and start anew by accessing your external javascript(s) files.

No offense. But I was wishing to help but do not want to start searching for the other threads or the external file. I would suggest that you aide us helping you by providing links to the other threads.

.....Willy

Drieske1982
03-12-2004, 03:46 PM
O, I'm, sorry. Didn't know the other information was relevant. :o

The form (http://www.aendekerk.be/beta/airco/bereken.html)
external JS-file (http://www.aendekerk.be/beta/java/watt.js)
excel-tricks with javascript (http://www.codingforums.com/showthread.php?s=&threadid=34854)
field_x should have the same value as field_y (http://www.codingforums.com/showthread.php?s=&threadid=34944)

Less relevant:
total of fields and an alert.window (http://www.codingforums.com/showthread.php?s=&threadid=34953)

Drieske1982
03-13-2004, 09:32 AM
Hi,
I've found something on the internet about it:

document.getElementById('some_field').readOnly=true;">
But how do i also make it unselectable, reset to zero and with gray background at the same time?

Roy Sinclair
03-15-2004, 02:41 PM
document.getElementById('some_field').disabled=true;"



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum