...

View Full Version : Javascript/HTML problem!!!



bboyle
07-08-2003, 11:27 AM
When I disable my webpage the text in my edit fields duplicates. e.g. ABC changes to ABCABC. THis only seems to happen when I have my edit fields in a <table>. A sample of my code is provided. I'd appreicate any help. Thanks, B.

<html>
<head>
<title>Test</title>

<script type="text/javascript">
<!--
function disableForm(form)
{
alert('disable form');
form.disabled=true;
}


// -->
</script>


</head>

<body>
<form name="formname">

<table>

<tbody>
<tr>
<td>

<input type=edit name="textinput" value="abc"/>
</td>
</tr>
<tr>
<td align=left>input</td>
<TD align=left><input type=edit name=userName>* </TD>
</tr>

</tbody>

</table>
<input type="button" value="test" onclick="java script:disableForm(this.form);" />
</form>
</body>
</html>

Kor
07-08-2003, 01:01 PM
It's alittle bit confusing for me... What do you want to do with this script? Which is the final ideea?

- see that there is a small mistake, but not essential, name="userName"

bboyle
07-08-2003, 01:55 PM
Sorry, I put up the wrong code! I have sionce changed it. This is only a very rough example that I put together. Basically I want to disable the form (i.e. button and textfields). My problem is that when my textfields are embedded in a table and then the page is disabeled, the text in the fields duplicates. I want to stop this happening and just the page to be disabled and the text in the fields to be displayed normally, not duplicated.
Thanks for your response.

Caffeine
07-08-2003, 02:14 PM
I've tested your code, and I think this is some kind of bug in IE.
What browser have you tested in and what version ?
I'm on IE 6.0


The text in the ABC-textbox is actually not duplicated, it only look that way. Try selecting the second ABC, you can't! You can only select the first ABC.

That seemed odd to me so I figured it's a bug, I then switched application and then switched back to IE, and there's nothing visible in that box! But if I'd select the content in it (which could not be seen, but I tried anyway) it's visible, but if you deselect it's invisible again. And there's only one ABC-value in there too, but invisible...

This has to be a bug of some kind, maybe some others can test with their browser and/or other browsers too ??


I also cleaned up your HTML a bit and tried, no differance.

Kor
07-08-2003, 03:24 PM
wouldn't suits to you simply to switch visible/hidden the textfield and the button? Use some functions to change CSS style than.

Roy Sinclair
07-08-2003, 03:34 PM
I think the problem may be that there is no standard for disabling form objects. Disabled is supposed be a element level property, not a form level property. MS seems to have (incorrectly) extended this property to the form object and then botched the implementation.

Other browsers like Mozilla don't recognize disabled as a property for a form.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum