Wordpress: Make cForms II pass named fields instead of field_X

When capturing the form data in my_cforms_filter() you may have noticed that the posted data does not use proper field names.

Array(
[field_1] => title
[field_2] => name
[field_3] => state
[field_4] => content
[id] =>
)



When setting up your cform, make sure you click "Use custom input field NAMES & ID's" under "Core Form Admin / Email Options".



You should note that this only applies to non-ajax forms, so you'll also have to untick the "Ajax enabled" option next to the form name.



Now you should see some named indexes which are a bit more relevant.




Array(
[Title] => title
[Name] => name
[State] => state
[Letter] => content
[cf_working] => One%20moment%20please...
[cf_failure] => Please%20fill%20in%20all%20the%20required%20fields.
[cf_codeerr] => Please%20double-check%20your%20verification%20code.
[cf_customerr] => yyy
[cf_popup] => nn
[sendbutton] => Submit
)



Lastly, if you want to name these fields, you'll have to set the label in a certain format.



Changing the "Title" label to "Title [id:my-title-field]" would now give you:




Array(
[my-title-field] => title
[Name] => name
...
)



Note: I've had problems using the ID "name", which causes the form to display a 404.

 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog