1

I have a dummy form that will act as a main switchboard for all my content types. For example:

My starting point in the form fill up process starts with the 'Enter basic categories' node type where user specifies the categories in a taxonomy hierarchy:

Classifieds
  -Autos
    -Aston Martin
  -Computers
   -Desktop
   -Laptop
  -Jobs

A user then selects any of the terms and the page now redirects to the appropriate content type form, e.g. computers_node_form

The thing is that Drupal saves this Enter Basic Categories Node Form data that I no longer needed.

Is there a way to cancel or prevent Drupal 7 to save the first content type before the redirect? Any suggestions?

1 Answer 1

3

So basically, you don't want a form for content entry, but you want a form to streamline the user navigation - right?

You can probably alter the node form (implementing hook_node_submit for instance) to stop it from saving data, but I recommend against it. The essence of a node is that it is site content, so it doesn't make sense to have a node form that doesn't save a node to the database.

You can build a custom form that does exactly what you want it to do by implementing hook_menu (to choose the url for your form) and a custom form generating function. See form_example.module for examples of custom forms.

1
  • I tried your suggestions but I'm stuck with issues of dynamism. See, If it was just a country->region->city that would be ok as I can see a fixed, 3-tier dropdowns and create three callbacks knowing it's three. However, I have a very dynamic site where classifieds sections can get very deep in the tree. I wont know how many levels will be there in the future. In effect, I'd need cascading dropdowns to be dependent from the last ajaxed dropdown, to produce another dropdown with ajax etc.. any suggestions how to do this?
    – jan
    Commented Oct 25, 2011 at 17:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.