1

I need to create a form for our Drupal Editors. The form must allow them to add records to database.

I see next steps to do:

  1. I add action in place I want.

  2. User clicks on action and modal form appears (that's I do not know how to do in Drupal way).

  3. User submits form and record is added to database.

  4. If possible refresh current page so user can see new record.

Could somebody please point me in the right direction?

So far I'm looking on: CTools Auto-modal and CTools Auto-modal Admin Interface. However I'm not sure if that is right direction.

  • 1
    The right direction is looking at form examples – No Sssweat May 20 '16 at 9:43
  • 1
    If you're in D7, it's probably easier to use the webform module How to Build a Drupal 7 Webform – No Sssweat May 20 '16 at 9:52
  • 1
    What's so special about those "records to be added to the database"? And as yet another alternative to @NoSssweat 's comment: how about using an approach similar to my answer to drupal.stackexchange.com/questions/164601 ? PS: which version of Drupal? – Pierre.Vriens May 20 '16 at 10:26
  • @pierre.Vriens I'm using D7. I will have a look on your suggestion, thanks! – Dmytro Pastovenskyi May 20 '16 at 10:48
  • @DmytroPastovenskyi : Thanks for the comment. But what about this: What's so special about those "records to be added to the database"? – Pierre.Vriens May 20 '16 at 10:50
0

Maybe just use a regular content type, add whatever fields you'd need, and let your Drupal editors edit regular nodes.

As a variation, use the ECK module so that you have custom entities (instead of nodes). And then let Drupal take care of storing the data in an appropriate table in the database. With such approach you get all sorts of extra facilities (integrations with other modules), out-of-the-Drupal-box ... Views, Rules, Group, Flag, you name it.

Another approach could be like I described in my answer to "How to implement a multi step approval with webforms/entityforms based on form components?".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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