1

I'm delving into my first custom Content Node Submission Form creation and looking at my first ever hook_form_alter() attempted efforts.
However, I'm confused over whether the WebForm module will do the job for me to allow user submission of new Node Content as I need to change the display of the said Node fields displayed. The way I read the WebForm documentation it's for emailed webforms and questionnaires, not really what I want but to submit new Node Content to the database, but others online say it can be used otherwise.

Would someone care to clarify before I waste another 2 hours effort?

Thanks in advance.

0

Webforms generally are best as contact/survey forms or some variant of them.

For an application like this, in my opinion it is just easier to implement your own form and do your own validation and submission. The validate handler could evaluate if the data is valid, and then the submit handler could create a new Node, set values, and save it.

Technically, you could do that submit Node creation handler with Webform, but it isn't as practical to me. Plus, if you haven't learned the Form API, this is a good opportunity to do so!

If this is Drupal 7, you could also take a look at Entity Forms and Rules, but again in my experience, getting to the goal is just faster with your own form or two and coding in what you want.

  • Thank you Kevin for your detailed answer. That clarifies that and saves me more time of 'trial and error'. Yes, I'm currently D7.4x. Apologies for what seems a trivial question, but my disability 'meds', make mental study a little difficult at times, so your answer is very much appreciated. (-: – Paul B Aug 15 '16 at 17:44
  • drupal.org/project/entityform seems like a module I missed!! thanks for the tip. – Paul B Aug 15 '16 at 18:00
  • Entity Forms is a valid approach, except in your case it sounds like you want to create Nodes from the submitted data. In Entity Forms case, it will create a new entity of the designated type (itself) meaning you'd have to clone the data to a Node. Also, every form will have exposed CRUD routes and permissions, like nodes and users, just general stuff to be aware of. On the other hand, it uses Fields to build form elements, but in the end if you are adept with Form API, smaller is better (to me). I generally would use Entity Forms if I needed a lot of things to happen that Rules can do OOTB. – Kevin Aug 15 '16 at 18:02
0

It depends what your preferences are, and maybe also what you're most comfortable with.

If it was my choice, I'd go for an approach as described in the question "How to create a node from a Webform using rules?". All you'd need is the Webform Rules module (and a custom rule that fits your specs).

  • What I want to do for now, is for a Node creation form (ie. musician apply's for band vacancy) to complete the Form which then create a specific Musician_Application_Node which can be managed by the system (CRON), Admin or Applicant member. Problem at this stage is the Application Node fields are showing some which I either: i) want hidden; ii) or other (can't think at moment!). The "hook_form_FORM_ID_alter()" option probably sounds more suited, so I'll stab at that for now as I can manage with the arrays concept etc. – Paul B Aug 15 '16 at 22:18

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.