Debugging FORM input fields for CFC

I wonder if anyone has some idea as to debug/output ALL the FORM input fields during a CFC form submission. We have to eliminate the handy in this case.

Hi,
something like this?

	<cfscript>
		if (structKeyExists(FORM, "send")) {
			dump(FORM);
		}
	</cfscript>


	<form method="post">
		<input type="text" name="fullname" placeholder="Full Name" />
		<input type="email" name="email" placeholder="Email" />
		<input type="url" name="website" placeholder="Website" />
		<textarea placeholder="message" name="Message"></textarea>
		<input type="submit" name="send" value="Send Message" />
	</form>

Good to know, Evan, thank you.

You can also check instead:

if (CGI.REQUEST_METHOD == "POST")
    dump(Form);
1 Like

I like your solution! Thank you! :raised_hands:

2 Likes

Thanks. Actually, you can also do it this way which can save a few keystrokes:

if (!isEmpty(Form))
    dump(Form);

The only downside of this one is that if you added any keys to the Form scope then it will not be empty anymore and the Form scope will be dump. e.g.

param name="Form.anything" default="";  // Form is not empty anymore
1 Like