I have several forms for a single content type in Drupal 7. The purpose of this is to initiate different workflows when the user submits the form, depending on the type of information included, and defined by the /url for each. These forms are on different pages and the fields shown on each are defined in a custom module. For example:
.../form1 initiates workflow 1 and displays fields a, b, e, f, g
.../form2 initiates workflow 2 and displays fields a, b, c, e, h
.../form3 initiates workflow 3 and displays fields a, b, f, x, y
In this module it looks something like this:
function my_custom_module_custom_form() {
// Build Form
$form = getForm('content_type');
switch (strtolower($form['#action'])):
case('/form1'):
$form['field_some_field']['#access'] = FALSE;
switch (strtolower($form['#action'])):
case('/form2'):
$form['field_other_field']['#access'] = FALSE;
I would like to have a page template for each form, so I can specify what goes into each, rather than showing/hiding every field for each within the module, which is cumbersome, given the number of fields.
Can I create a page template for each form and link the submit button to trigger a particular action in the module?
Note: adding dependencies or using separate content types is not applicable to our use cases. If there are errors in the code above, it is only that i've given a quick example here, the actual module works.
Thanks for the help!
I have created the theme suggestions for a particular node form:
So here's what it looks like now:
Please let me know if you need any more details.