0

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?

thanks

  • Please explain your requirement a little more – Ashish T Sep 13 '14 at 17:59
  • ok , I revise the text – Ehsan Sep 14 '14 at 12:11
  • I think this link may help you isovera.com/blog/programmatically-creating-forms-views-drupal-7 – Ashish T Sep 14 '14 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 Sep 14 '14 at 16:44
  • Moreover, the author of that website is not responding the comments and questions about his solution. – Ehsan Sep 14 '14 at 16:45
0

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, privacy policy and cookie policy

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