I am trying to convert a view to a form as follows:

I need to have a table of articles (which can be produces easily by views) and inserting a checkbox next to each row (article), and a button next to this table as Submit button. The created form out of the articles` view should be able to initialize the value of the checkboxes before showing them (which can be done somehow by form_alter).

So, the problem is that I really don't know how to create this form.

I used VBO, but VBO does the operation for the selected rows! I need a method which can help me to set the values of checkboxes by code, before views render, and when the submit button is clicked, whole rows should be checked!

can you please suggest a tested & working solution?


  • Please explain your requirement a little more
    – user33576
    Commented Sep 13, 2014 at 17:59
  • ok , I revise the text
    – Ehsan
    Commented Sep 14, 2014 at 12:11
  • I think this link may help you isovera.com/blog/programmatically-creating-forms-views-drupal-7
    – user33576
    Commented Sep 14, 2014 at 16:15
  • Thank you! I have already implemented this solution, and the views_form_submit and '#element_validate' sections are not working at all. That's why I mentioned to receive a tested & working solution. Again, thank you
    – Ehsan
    Commented Sep 14, 2014 at 16:44
  • Moreover, the author of that website is not responding the comments and questions about his solution.
    – Ehsan
    Commented Sep 14, 2014 at 16:45

1 Answer 1


view_form_submit is not working in D7, you have to use the hook_form_alter and then you have to change the #submit:

$form['actions']['submit']['#submit'][] = 'custom_form_submit';

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.