Page 1 of 1

works on mozzila, doesnt work on IE

Posted: Sat Dec 16, 2006 2:15 pm
by sarris
Hi there...Have a simple question, but dont really know how simple the answer is

My site works perfectly on Mozzila and has a problem with IE no matter the version.

I have a text box that is disabled in the beggining. In Mozzila when the page loads that textbox is grey.
<input type="text" name="textbox1" size="20" disabled = false>

When a particular radio button is pressed a Javascript function is called and it becomes enabled.
<a href = "javascript:enableRentPrice()"><input type="radio" value="V1" checked name="R1"></a>

The function
function enableTextBox(){
document.forms['form1'].elements['textbox1'].disabled = false;
}


When opening the page with Internet Explorer
A) The text box is not grey
B) The text box doesnt get clicked and doesnt get any text
C) The function doesnt change anything

Might be smth trivial...Any ideas plz?

Posted: Sat Dec 16, 2006 2:25 pm
by Burrito
why don't you make it a checkbox instead of a radio button. Also, you cant really put a checkbox or radio in a <a> tag like that. It might work, but it's definitely not conventional. Instead use an onClick event of the checkbox.

like this:

Code: Select all

<script>
function enable(obj)
{
  if(obj.checked)
    document.forms[0].textfield.disabled = false;
  else
    document.forms[0].textfield.disabled = true;
}
</script>

<form>
<input type="text" name="textfield" disabled="disabled"><input type="checkbox" name="someCheck" onClick="enable(this)">
</form>

Posted: Sat Dec 16, 2006 2:39 pm
by sarris
I need radio buttons cause there are other choices as well and only one must be selected.Thats not the issue
The thing is that when the page loads the textbox is not grey as in mozzila and its clickable...There is another textbox with the disabled attribute set to false and its not clickable as well...So maybe there is an issue with the disabled??...or maybe its the inclusion of the radio button on the <a></a>
I'll try to change that and see what happens.Its the second time im told off for that weird technique so i'll pass and change it...
Will let you know

Posted: Sat Dec 16, 2006 2:59 pm
by sarris
Cool...ok.things are wokring nicely for IE after i removed the <a></a>
One little difference is that the disabled textbox is grey on Mozzila when in IE its still normal looking, but just not clickable...
Is there any way to make it look in IE as it looks in Mozzila?

Thanks anyway, at least its working!

Posted: Sat Dec 16, 2006 3:40 pm
by Kieran Huggins
as a matter of proper syntax, the disabled property is assigned like this:

Code: Select all

<input type="text" name="textbox1" size="20" disabled="disabled" />
and

Code: Select all

<input type="text" name="textbox1" size="20" disabled="false" />
Cheers,
Kieran

Posted: Sat Dec 16, 2006 3:57 pm
by sarris
<input type="text" name="textbox1" size="20" disabled="disabled" />
That wouldnt change anything...If its more proper i will do it, but still, any ways to make the disabled look different that the enabled?

Posted: Sat Dec 16, 2006 4:15 pm
by nickvd
No, it's up to the browser to determine that.

Heck, you can barely style form elements at all in safari...