Thanks Russ you are spot on with the problem which leaves me amazed that we have no control over rendered IDs.
I thought of changing the id to class but although I could do this for most IDs I do use some for hooks to snippets of unobtrusive JavaScript I use, which would break these processes.
Talking of which, members of this forum have all seen the light regarding the separation of presentation from structure using CSS. Great! However, unobtrusive JavaScript does the same for behaviour as CSS does for presentation. The rendering of behaviour used
by server controls produces loads of in-line and embedded JavaScript, especially ATLAS controls. We have a long way to go to overcome this but perhaps a simular approach as yours is possible.
Anyways, I thought I would leave my form as is (Totally standards and unobtrusive), action an aspx to do the processing, and would you believe it, I cannot find a way to simply read a form field by name. Are we going backwards?
The best I can do is run a loop to find out the index to each field and then access the fields I need by the index, so my interegation code might be:
For i = 0 To Request.Form.Count - 1
itemName = Request.Form.AllKeys(i)
itemValue = Request.Form.GetValues(i)(0)
r = r & i & "." & itemName & " : " & itemValue & "<br />"
Next
lblOut.Text = r
and after copying and deleting the results for reference I could use code like:
Brave.heart
Member
25 Points
6 Posts
Re: Rendered id attributes
Aug 24, 2006 02:56 PM|LINK
I thought of changing the id to class but although I could do this for most IDs I do use some for hooks to snippets of unobtrusive JavaScript I use, which would break these processes.
Talking of which, members of this forum have all seen the light regarding the separation of presentation from structure using CSS. Great! However, unobtrusive JavaScript does the same for behaviour as CSS does for presentation. The rendering of behaviour used by server controls produces loads of in-line and embedded JavaScript, especially ATLAS controls. We have a long way to go to overcome this but perhaps a simular approach as yours is possible.
Anyways, I thought I would leave my form as is (Totally standards and unobtrusive), action an aspx to do the processing, and would you believe it, I cannot find a way to simply read a form field by name. Are we going backwards?
The best I can do is run a loop to find out the index to each field and then access the fields I need by the index, so my interegation code might be:
For i = 0 To Request.Form.Count - 1
itemName = Request.Form.AllKeys(i)
itemValue = Request.Form.GetValues(i)(0)
r = r & i & "." & itemName & " : " & itemValue & "<br />"
Next
lblOut.Text = r
and after copying and deleting the results for reference I could use code like:
email = Request.Form.GetValues(10)(0)
Once again, there must be an easier way!!?
Bill