
Referencing all controls in a given form
Mike,
First thing you need to do is to make sure that you're working with
objects when using syntax like "For each xx in yy".
So,
Set oElements=Document.FormName.Elements
For Each oElement in oElements
'Code
Next
Another thing to watch out for here is that not every form element has a
default value property (a button for example only has name, type and value
properties). So you would need to add code (maybe Select Case statements)
to check the elements type (radio, checkbox, text, button, submit, reset,
etc etc), and only perform default value checking for appropriate elements.
Luke
Quote:
> My apologies for posting something so trivial, but please can someone end
my
> confusion?
> I'm attempting to survey all the various inputs in the single form
> (addressstuff) on my page to see if any have been changed.
> FormClean = True
> For Each item in document.addressstuff.elements
> If item.value <> item.defaultvalue Then <<<<< PROBLEM
> FormClean= False
> Exit For
> End If
> Next
> I get a runtime error "item - illegal assignment" at the marked line.
> Thanks - Mike -