Forums

Does Chronoforms have reserved field names?

Grumpster 11 Feb, 2010
Hi,

I've built a few Chronoforms and never ran into this before.

Today I was trying to create a simple to-do list using Chronoforms. I created my form and put it on a test page. I'd fill in the fields, hit submit, and then ... nothing. The form would not submit, at all.

The form was simplicity itself, but it would not submit. I deleted and recreated it about six times. I tried duplicating a working form, then edited its fields for use as my to-do list form, and still it would fail.

After about 2 hours of troubleshooting (and thinking I'd lost my marbles), I found the problem.

The first field in my to-do list form was, quite naturally, called "Task". I named the field "task" too. And therein lies the rub: you cannot have a field named "task" or the form will not submit.

What's odd, that even with Debug ON, I received no error message of any kind.

I searched this forum for "reserved words" but found nothing, so I'm thinking this isn't a common problem. Maybe?

If I am correct, and "task" is a reserved field name, is there some way to make Chronoforms spit out an error when debug mode is ON when reserved words are encountered?

Still love Chronoforms🙂
GreyHead 11 Feb, 2010
Hi Grumpster,

Never crossed my mind that his might be a problem - and probably not Max's either when he wrote the code.

There could be quite a few words to avoid. ChronoForms uses task=send in the onsubmit url and extra to link to the extra code boxes and Joomla uses task widely in urls along with option, view, and a bunch of others.

Possibly the answer is that ChronoForms could distinguish between the 'get' & 'post' flavours better.

Bob

PS And then of course both PHP and MySQL have reserved words too . . .
nml375 11 Feb, 2010
Hi,
Just to add to the list, also avoid these:
chronoformname, format, tmpl, tp, cid, Itemid, print, showall, id, type, layout, no_html, template.

That should cover field names used by Joomla, included modules and plugins, as well as chronoforms. Other plugins and modules might use other field names, and I might have overlooked some other.

These could still be used to some extent, but you should be aware of how they influense the system. Adding something like "format=raw" would completely drop all output except the chronoform "thankyou" page - and is something you'd normally use to return an JSON-object (used for advanced ajax scripting, etc).
Adding "tmpl=component" would instead show the "thankyou" page in the template, but without any modules or menus (exact behaviour may vary between templates).

Given the problem that 3rd-party modules and plugins could depend on any random field name, and that a CF-form not necessary have to be submitted to a CF or even Joomla script, I think it would only cause more issues trying to filter or identify "bad names". Also, having the Debug output respond to use of "reserved fields" would be rather difficult, since you still need to provide both "task" and "chronoformname" for CF to know what to do in the first place.
Finally, there are some cases where mixing GET and POST-style form fields is rather troublesome - making the current behaviour more of a feature. I suppose the code could be tweaked to prefer GET data as to POST when it comes to "chronoformname" and "extra". "task" is unfortunately provided through Joomla.

A hint:
If you'd like to make "absolutely" sure you're using unique form field names, try prefixing them with "cff_" or such.

/Fredrik
Grumpster 11 Feb, 2010
Greyhead and nml375,

Great info and suggestions!

I like the idea of prefixing my form field names with something like "cff_". I'm going to make that a habit starting now.

Brilliant stuff. Thanks🙂
This topic is locked and no more replies can be posted.