just looking for a quick answer to this. this is probably something elementary to most CF programmers. i'm attempting to validate a form, i've got an arbitrary number of email fields in the form populated by a query.. so each email field is named 'email#currentrow#' now when i'm trying to loop over all the emails to validate them i first want to ensure there are no malicious characters.. i.e. i want to throw an error if someone were to write something along the lines of '<script ...' in the field.. the problem that i'm having is i don't know how to get what's inside that form field other than using 'evaluate("email#loopindex#")'.. which goes ahead and runs whatever malicious code is inside the field before it's validated. so i'm looking for something to replace the evaluate() method... any ideas?
The "form" or "url" scope can be accessed with array notation <cfoutput>#FORM["email"& loopindex]#</cfoutput> Code (markup):
looks like it's working perfectly.. i simply replaced the 'evaluate("email#loopindex#")'s in my code with 'FORM["email"& loopindex]'s and all is well.. thanks a lot
Glad to help. CF guidelines recommends using array notation over evaluate anyway because evaluate is a slightly more expensive operation.