Drupal: Custom Form Creation, Best Method [closed] - drupal

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm relatively new to Drupal, but not CMS's in general. I'm creating a site for a client. The most important part is creating a fairly complex form in which users input various types of data to be stored in the database. I had assumed the best method for doing this was to create a custom module. Is this the case, and if so can someone direct me to documentation or a tutorial on the best way to create a module of this nature? If not, I'm open to suggestion for the best way to create this kind of form even if it is hardcoding the content.

Drupal.org contains detailed tutorials on how to create modules, see for example this one.
The Drupal Form API will be your friend to handle easy data capture: How to use the Form API.
Depending on your data capture needs, the Webform module may already do what you want.

In drupal there is a Form API to do this, a very good working example is used in the documentation at drupal community, here are the links for that:
Drupal 7 Form API introduction
Form API reference for Drupal 7
And one more thing Never go for hard coding things try taking the advantage of all available API's.

You haven't detailed who the users are that will be inputting data into the form, the complexity of the form or what you will do with the data so I'd like to present you with some other options.
Custom Content Type
You can create a custom Content Type and assign appropriate permissions so that users can fill in the content creation form and it can be saved in the database as a Node entity. The Node is a core Drupal entity and therefore already has many built in capabilities for sorting and displaying using the Views module and permissioning, etc.
But the users filling in the "forms" (ie. creating Nodes) have to be registered Drupal users.
Webforms Module
Drupal has a Webforms module which will allow you to create a form without having to do any custom coding. The module looks after creating database tables and already has a lot of built-in functionality.
Refer to the other answers if you find that it's still most appropriate to create your own module.

Related

Form Input Validation with Meteor [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Meteor doesn't have a built in validation smart package yet. What validation libraries should I consider? What are other people using?
We decided to use simpleSchema with Collection2 and autoform for validation. It's a very sophisticated solution. We save a lot of time using this approach rather than trying to roll each form by hand.
Simply by defining a scheme with validation rules (validation rules are provided automatically for data type and isRequired settings) then creating a form with autoForm (a single line of code) and you get all this for free
An autogenerated form that uses bootstrap3 classes.
Appropriate HTML5 fields for all keys in your collection schema.
A submit button that gathers the entered values and inserts them into your collection.
Form validation based on the schema attached to your collection. By default the form is validated when the user submits. If anything is invalid, the form is continually re-validated on keyup (throttled) as the user fixes the issues.
Default validation error messages that appear under the fields, and can be customized and translated.
meteor-simple-schema
A simple, reactive schema validation smart package for Meteor.
https://github.com/aldeed/meteor-simple-schema
meteor-collection2
A smart package for Meteor that extends Meteor.Collection to provide support for specifying a schema and then validating against that schema when inserting and updating. Also adds support for virtual fields.
https://github.com/aldeed/meteor-collection2
meteor-autoform
A smart package for Meteor that adds UI components and helpers to easily create basic forms with automatic insert and update events, and automatic reactive validation.
https://github.com/aldeed/meteor-autoform
If you want to use meteorite, you can just search through the atmosphere packages to see what's popular. I'm currently using jqBootstrapValidation. In the past I have used validate.js, but right now I prefer to have something with bootstrap integration. I hear parsley.js is popular with the cool kids, though as of this writing there isn't a smart package for it - but that's easy enough to solve.
You already have Tracker as part of Meteor, so I put a little tutorial and JSfiddle together on how to use it to implement a typical form validation scenario.
http://bit.ly/meteor-form-validation-video
http://bit.ly/meteor-form-validation-fiddle

How to customize web-app (pages and UI) for different customers [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
We have an ASP.NET web-application which has become difficult to maintain, and I'm looking for ideas on how to redesign it. It's an employee administration system which can be highly customized for each of our customers. Let me explain how it works now:
On the default page we have a menu where a user can select a task, such as Create Employee or View Timesheet. I'll use Create Employee as an example.
When a user selects Create Employee from the menu, an ASPX page is loaded which contains a dynamically loaded usercontrol for the selected menuitem, e.g. for Create Employee this would be AddEmployee.ascx
If the user clicks Save on the control, it navigates to the default page.
Some menuitems involve multiple steps, so if the user clicks Next on a multi-step flow then it will navigate to the next page in the flow, and so on until it reaches the final step, where clicking Save navigates to the default page.
Some customers may require an extra step in the Create Employee flow (e.g. SecurityClearance.ascx) but others may not.
Different customers may use the same ASCX usercontrol, so in the AddEmployee.OnInit we can customize the fields for that customer, i.e. making certain fields hidden or readonly or mandatory.
The following things are customizable per customer:
Menu items
Steps in each flow (ascx control names)
Hidden fields in each ascx
Mandatory fields in each ascx
Rules relating to each ascx, which allows certain logic to be used in the code for that customer
The customizations are held in a huge XML file per customer, which could be 7500 lines long.
Is there any framework or rules-engine that we could use to customize our application in this way? How do other applications manage customizations per customer?
If your regular data is held in a database I'm not entirely sure why you'd want to have all of that customer specific information in an xml file. Move it into the database.
Next, there are many different kinds of rules engines out there. Considering you're using asp.net you might want to look at Windows Workflow for at least some of this. You might read the following: http://karlreinsch.com/2010/02/05/microsoft-rule-engines/
A long time ago I used a product called Haley Rules to drive a c# web app. It controlled everything from the screens that were available right down to the fields that appeared and whether they were required or not. It took awhile to get the team on board with how it worked, but once that happened bringing on a new client was extremely simple. Haley was since gobbled up by Oracle, but was probably the absolute best one out there.
Others you might be interested in are NxBRE and even nCalc. NxBRE is an actual rules engine which is a port of one built for java. nCalc on the other hand isn't a rules engine per se. However, if you can express your logic in simple boolean statements then it is extremely fast. I'm currently using this to drive page flow in one of our applications.
Some commercial ones include: FlexRule, iLog
Your existing rule engine tool supports your web application, which means it meets your needs already. You can use other "Rule Engine" like MS work flow, but IMO it can also end with a hard to maitain situation.
Let's say there is registration portal. It collects general user infomation and save them into database. Simple. we build one protal for one client with several ASCXs and Rules.Then for another client,we add more rules and more controls to these ASCXs. Working in this way, sooner or later we will reach the final straw client. At that time the code base is hard to maitain and devs lost themselves in lots of rules. It is what happened to me.
So to me, it is not about which Rule engine to use.
Then How?
I have raised a question, and one of the answer makes sense to me( thought not a picked answer). In this answer, the guy mentioned what kind of company you are. In your question it is more like which department you are or do you want to seperate your dev teams.
If you are in a archetect teams, build a framework with a rule engine. Create a basic registraion portal as a sample portal.Make DAO,BO decoupled with UI (Seperate layers).
If you are in a customise teams, create customised user control (dont reuse these user control in basic version). What you will recreate is just UI, you can still use DAO,BO as they are not defined in user control, they are at other layers. In this way you get the freedom to define your client specified rules without worring about contaminating other clients rules or introducing new bugs to other client's registrations.
Just realise it is not like an answer to your question. Anyway it is my thoughts after limited xp of working on a engine rule based ,multi-clients web application.

How could you dynamically create a pdf within wordpress? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm using a Contact Form 7 to have the users enter data, then based on their data entry, I need to add different text to the pdf before outputting the entire pdf.
For example, if the user says they like red balloons, the created balloon pdf will mention how important red balloons are, etc...
I know there must be a way to do this using fpdf, tcpdf, or something, but I'm not sure how. Any ideas?
Take a look at dompdf Its is very easy to use as well as good implementation documentation.
You may wish to use PHP's native PDF functions wrapped in a custom Wordpress plugin to generate your own PDF documents. Check out the PHP.net Manual: PDF for an overview. I'm there there are plenty of PHP=>PDF vendor libraries out there if you search the Google's.
Another solution, off the top of my head, would be to run a worker process somewhere to convert and return documents in [?|PDF] formats based on Wordpress data fed through a template system (mustache, twig, etc).
create a child plugin, this guy done it or is doing it: http://wordpress.org/support/topic/plugin-contact-form-7-add-attachment-with-wpcf7_contactform-class?replies=1
First of all I really recommend using Gravity Forms, it's a better plugin for forms and it also saves entries in the database so you can retrieve them.
For the PDF part, I think you need to program it manually.
Create a php file that implements tcpdf, and receives all input from the form (via POST or GET). Then you have all the parameters you need and you can create the PDF in any way you like.
In order to use this php file, open a Page in Wordpress and then rename the php file to page-.php (where XXXX is the new Page ID you opened)
install the pdf creator plugin from this url. Hope this help you.
http://wordpress.org/extend/plugins/kalins-pdf-creation-station/

Drupal - form or content type and general how to do it?

(I know there is a module, but I'm trying to learn on my own)
I basically want some kind of form or page where I create a form for an administrator.
So, the administrator can fill in the question and can add more than one right answer. Sorta like a multiple choice question with more than one answer.
The user will go ahead and answer the question.
Do, I create a content type? Do I use form api instead. Not sure at this moment how to go about it.
Thanks.
The Quiz module provides tools for authoring and administering quizzes through Drupal. A quiz is given as a series of questions, with only one question appearing per page. Scores are then stored in the database.
From what I get, you can create a custom drupal module and use form api for creating Multipage forms and add pragmatically add validaters for adding you correct result before moving to the next page/form.
Writing a simple. Hope this helps and contact if you need help.

Should I use Orchard or umbraco or something else? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I am building a web site for baby names. Users can submit a name, meaning and some tags, and moderators can edit/approve it. Very small amount of data is used for each entry/post.
Looking for some kind of framework that supports the following features or I can easily extend it,
Unicode support
I have large number of names, I should be able to import them into my website by code.
User roles and permision
Some kind of report options. For example, Display list of names that starts with some alphabet or list of names for a #tag
Full text search
oAuth/OpenID
Are there any frameworks like Orchard, Umbraco I can leverage or would I be better off writing a new ASP.NET MVC application?
If I were you I'd surely stick to some available CMS platforms (Orchard or Umbraco) instead of writing from scratch and reinventing the wheel.
From my experience with Orchard I can say that setting up a website as you described would be pretty easy and painless with this platform.
Features like those you mention are already available in Orchard, but I guess (as with just about every CMS) this will surely need a little customization to suit your particular need. All the custom functionality could be easily wrapped in a single, custom content part. How to do that is very well described in the Orchard documentation.
Of course.
Without a problem. You have three options: import directly into Orchard DB (into the corresponding tables), import using Orchard Import/Export functionality (which would involve exporting the data to XML recipe format first) or just use the current data source without the need of importing. There was a question on SO a while ago of getting data from a custom WebService. The solution provided perfectly fits here, so please take a look.
Out of the box - described here and here.
I don't know if you meant the backend (admin) view or in the frontend? Tagging and displaying tagged items is available oob. More complex, custom reporting would involve some custom coding (writing a custom content part).
Available and described here.
Sure! It's available via very nice OAuth Module, written by Nick Mayne. It allows you to bind Orchard accounts with OAuth providers.
I don't have much experience with Umbraco though, so I can't give you any direct help, but I guess it'd be nearly as easy to built your website using it.
Personally, I prefer Orchard for its flexibility, extensibility and code freshness. But the choice is a matter of your personal feeling and preferences. From what I've seen they have very similar functionality, although differ much under-the-hood.

Resources