
Originally Posted by
rizlaa
I have typed in your alert as specified and the alert box that popsup shows the output as you have stated. "2 5 f02[4]".
Then you should know the values that cause it to fail: the last message to appear before the error should display values that refer to a form control that doesn't exist.
For example, can colNum ever reach double digits? With the currently suggested code, that would produce a leading sequence like "f013", which is unlikely to exist. Similarly, could rowNum ever be zero? That would produce a trailing sequence like "[-1]".
have tried the following with the same error being displayed:
document.forms.form1['f0' + colNum + '[' + (rowNum - 1) + ']'].value = 'U';
The above should equate the values in the [] as in the alert test?
Yes.
Try the following snippet:
Code:
function test() {
var colNum = 1,
rowNum = 1;
alert(document.forms.myForm.elements['f0' + colNum + '[' + (rowNum - 1) + ']'].value);
}
HTML Code:
<form id="myForm" name="myForm" action="">
<div>
<input name="f01[0]" value="Some value">
<input type="button" value="Test" onclick="test();">
</div>
</form>
If you include that in a simple HTML document and click the button, a dialogue box will display "Some value".
i'm afraid my app is not externally visible.
Fine, but unless you post code, no-one here can help you debug the problem.
At the minimum, you need to include the form element and its contents, the function where you attempt to access the form controls, as well as the functions that call it and those that it calls. Ideally, though, you would create a separate, and simpler test case - you might even find the error yourself doing that.
Mike
Bookmarks