-
- 21 Posts
Here's what I would like to do, and forgive me but I am a designer not a programmer.
I would like to place two hidden fields in a form, "firstname" and "lastname" as an example, on submit, loop through the form for values in those fields, if values exist, don't submit.
Using formit currently to handle submissions.
Can someone help?
-
- 24,544 Posts
http://rtfm.modx.com/display/ADDON/FormIt.Using+a+Blank+NoSpam+Field
A word of warning, though. If you use "firstname" or "lastname" some people with password managers like Roboform and LastPass are not going to be able to submit anything because the password manager will try to be helpful by filling in those fields.
Also, some spambots are smart enough not to fill in a hidden field.
-
- 21 Posts
Awesome, all wrapped up, worked, thank you.
One last question, how would I get the page to anchor to the form if it's middle of page? Right now it reloads the page with errors, which is great obviously, but user has to scroll down to see the errors.
I know how to do anchors, but how do I get the redirect to anchor down the page?
-
- 24,544 Posts
I almost never use FormIt. Hopefully, someone with more FormiIt experience will step up.
Are you sure that is the field names exactly? Usually field names are all lower-case.
-
- 21 Posts
Yes, sure.
The form worked correctly, redirected, etc, before I added the spam stuff and validation. Now it validates correctly, but doesn't submit.
-
- 21 Posts
So i took this part out: [[!+fi.error_message:notempty=`<p>[[!+fi.error_message]]</p>`]]
and it works fine, I'm not sure why.
Still looking for any way to anchor the page back down to the form if error exists?
Thanks,
-
- 24,544 Posts
You should be able to use the anchor in the form's action:
<form action="[[~[[*id]]]]#MyAnchor" />