Drupal 6.x Add More Module - No end to adding more - drupal

Simple question for all of you here dealing with Drupal 6.x...
With Drupal's Add More module, is there a way to configure my webform so that there is no limit on how many of a specific fields I can add more of?
Please see my image for example:
For example, I'd like to enable the user to add as many titles as they would like. Is that doable?

Unfortunately, it's not currently possible to add unlimited "add another" functionality with webforms. And if this functionality does become a reality someday, I doubt it will be backported to the Drupal 6 version of the module. From the webform modules author (quicksketch):
there is no progress on this subject. The ability to support multiple
values requires a tremendous amount of re-architecting, including
changes to the way CSVs are generated, analysis, the database
structure, and the UI (both for administrators and users). I wouldn't
expect this feature to be added any time soon.
See this thread for more information:
http://drupal.org/node/354381
I would suggest using a node and the CCK module plus rules and views to collect this information.
Assumptions:
Anonymous users can fill out the current form
You need some way of retrieving the data that is submitted
Regular users of the site should not be able to view submissions
Very loose directions:
Create a content type and add all of the fields that your current webform contains to it. CCK has the ability to store unlimited values out of the box. On the field settings page, inside the Global Settings fieldset, select "Unlimited" for the "Number of Values" field.
Give anonymous users permission to Create [your-new-content-type] Content on the Role Permissions page.
Using the Rules module, create a new triggered rule that fires on "Content is about to be viewed" with an condition "Content has type [your-new-content-type]" and an action of redirect to homepage (or a custom error page that you created). (Note: this is a bit of a performance hit. There are better ways to restrict access to this content type, but for the sake of this tutorial, this was the easiest to explain)
Using the Views module, create a new view with Style set to Table. Add each of the fields in [your-new-content-type] in the fields section. Under "Access" choose "role" and select the role that is assigned to your user. Add a "page" display, give it a Path and save. This is the page you will use to view submissions.
Optional:
Use the Rules module to send yourself (or the submitter) an email when a node of [your-new-content-type] is created.

Related

How to display teasers (fields), dependent of conditions user put into webform in Drupal 7?

I want to make site that displays form, and makes user capable to input certain parameters in it. For example, real estate site. Let say I have these fields among others: location, price, size. If user choose to see houses under 100 000$, Drupal has to back node teasers (fields) for houses only under that price.
Now, I wonder how to make Views module start searching when user click submit button, and how to make conditions under which Views search, dynamically dependent of parameters users put into form.
Do I need some additional modules beside Views and Webform modules? Or maybe, I don't need them? Maybe I have to write some php/mysql script that do searching and fetching, but, naturally, I think Views module is build for that kind of circumstances. Thanks in advance!
1) There is an option in Views when you create the exposed filters: "Remember the last selection". This caches the user selection for each Views and when user visits the Views again he will see the previous filters enabled.
2) For better UX you can use Better_Exposed_Filters and Views_Saved_Searches modules. With the first one you have much more options for exposed filters (eg expose as checkboxes) and with the last one users can save their searches and use them later (like bookmarking a url path).
PS. I don't think using the Webform module with views will be useful in order to create personal saved searches. Instead, Views Saved Searches is what you are looking for.

How to create a custom form in drupal

I need help on how to create a 'custom form' using the same fields provided by cck.
Drupal gives you the ability to add fields to 'nodes' and how to theme their output. But I would like to be able to post a data from my own form (that pops-up) and sends data to the drupal database using the same drupal cck.
How do I access the specific form inputs to add data to my content types ? because the default form is kind of 'ugly' and loads on different page(without ajax).
Help would be much appreciated
There are several routes you could go down.
The easier option is to use the Webforms module. While this gives you similar fields to cck, they are not exactly the same, and if you have a module that implements a specific cck field type, it won't be available to webforms.
The second choice is to write your own module using the forms api. This can mean a lot of learning, add it takes time to get up to speed, but ultimately you have total control over how your form will look and behave. The forms api doesn't give you exactly the same fields, but all the tools are there to create them. Sometimes you need to hack open a module to find out haw a specific field is implemented.
A third option would be to use cck itself. You could create a content type and add the field types you want on your form. You would them give users permission to create but not view or edit the content type. The form submissions would them be nodes on your website. This would make me slightly nervous, so make sure all your permissions are correct!
The second part of your question: you can use a theme file to override the appearance of most forms and make them pretty.
James

Display different content for anonymous and logged in users

What I need to accomplish is this:
If an anonymous user visits the site, show regular site content.
If a user logs in to the site, then user-related content appears in place of the regular content.
I would like to accomplish this using the Views module.
I have looked at the Premium module, but it seems to be abandoned. I would like to avoid using the content-access module if at all possible, since I already have other access controls in place.
If you are creating a page display for the views, you can accomplish this with view's access controls. Views will show the first available display that the user has permissions to.
Create a display for the authenticated user view
Set the page path
Set the Access restrictions (eg., by Authenticated role)
Create a display for the anonymous user view
Set the page path to the same value
Optionally restrict access to the Anonymous role (not necessary, since if views can load the authenticated display for the user it will not bother with this one, but may keep it's use clear)
Since you cannot re-order the displays in a view (yet), you must define the views in the order of most restrictive to least restrictive.
For more complex displays, you can use the Panels Pages module to render the page differently based on a user's role.
If you only want to differentiate between anonymous and authenticated users, you can specify that different content blocks are visible to each role.
On my own site, I needed to differentiate between Administrators and everyone else, so I could not use the authenticated user role to define access for individual items. Similar to Views, with Panels Pages you can define multiple variants of pages that use the same path. Administrators have access to the first variant, and all other users fall through to using the second.
You could try using the CCK content permissions and set permissions on a per field basis. Then have different fields for different content that you want to publish. I believe this is included with the CCK module.

Allowing different user types registrations in Drupal 6?

I have two types of users on my site:
Normal user
Supplier
How do I set up Drupal so that you can choose which type of user you want to be before signing up, and then also (and this is the tricky part) give different profile fields to the different user types?
Consider the Auto Assign Role module. Here is a quote about it (from the module's project page):
... serves three primary purposes. The first is to provide an automatic assignment of roles when a new account is created. The second is to allow the end user the option of choosing their own role or roles when they create their account. The third is to provide paths that will trigger a specific role when an account is created. The administrator has full control over these functions and can have them working together or independently of each other. Auto Assign Role is integrated with the Content Profile module so that you can have content types serving as registration pages. You can even replace the default user/register page with a customized version of your own design.
Use the User Types module. Here is a quote about it (from the module's project page):
... gives you the power to make custom profiles for certain types of users. The core profile module must be enabled for this. It let’s you determine for which profiles a field will be active. For example: If we want a field where you can enter who’s your favorite band, you create this field and at the bottom you can choose for which user types (which you defined earlier in admin/user/user_types) this field will be active using the checkboxes. It’s that simple. It's also possible to automatically assign a role per user type.
Important: This module uses a theme override to hide profile categories which are empty for the associated user type id. Make sure to consult the documentation to copy the PHP snippet into your template.php.

Can CCK take care of my fields for a programatically defined node type in drupal?

Does the CCK api allow me to create a node type, from a custom module, with a bunch of fields that use CCK to store their state? If so can these fields be locked so that users may not alter them, but still allow the user to add more fields to the node type?
Thanks
I think the answer to your first question is "yes" (for Drupal 6, at least, which has elements of the CCK integrated into Drupal Core). I believe the Amazon module does this sort of thing, albeit it with just one field.
I don't think the idea in your second request is achievable, though. This would seem to require field-level permissions' control whilst Drupal only supports module-level permissions' control.
You could add validation code in the GUI which restricts CCK fields being interfered with on your content type. This would not prevent another module getting in there with an axe, though.
You could add checks which restore your preferred CCK settings whenever they detect some unwanted changes.

Resources