Drupal WebForm Conditionals - drupal

I need to build a webform where one of the questions asks the user to pick a date from a list of 5 dates. Each of the 5 dates only allows 10 attendees. How can I track the number of people that have registered for each date and limit the number of attendees? Thanks for any help.

Go for some custom solution. I.e. create some content type with 5 integer fields where you will keep count of attendees per day.
Then hook that webform (hook_form_alter()) and add another submission handler function, like described here:
Drupal 7 Webform submit hook
In that function (submit handler) read the form values increase counter if it has free space or shoot some message that no more places remained.

Related

Asp.net how to suggest multiple words inside textbox

Summary: I'm doing a web app to manage products in a warehouse. So I have a db with list of products and quantities. I have one page for unload products when they are used. On that page I have a textbox in which users write the note on how the product has been used.
Request: when users type inside the textbox I'd like a popup to appear showing products that contains the entered characters. More than 1 products is possible. Also users enters quantity of the used products, so I'd like that my app can update the db with new value.
For example:
I have a product named "AAA batteries" and I have 10 in stock.
I also have "9V batteries" 5 in stock.
User write "Used 3 AAA batteries and 4 9V batteries"
While typing I'd like popup appear suggesting "AAA batteries" etc.
Then I'd like to update the db subtracting 3 AAA and 4 9V.
It's ok to use delimiter characters
User press a button to save the note (db should be updated at this point)
Is this possible? I'm already using the ajax autocomplete extender but it can't do exactly what I want. I did a lot o searches but I can't find the right direction, can you help me? Thanks

Drupal 7 custom module/field for adding a task per hour

I am fairly new to Drupal and I am trying to create a simple content type where people can add their schedule for today.. for example from 2PM tot 4PM that person has to go to the gym.. So 2 dropdowns, 1 for every hour (2PM&4PM) and adding a textfield to that for "going to the gym" and the possibility to add more tasks.. (multiple values per day)
Any advice? Maybe a module or creating a custom field? Thx in advance.. :)
If you want to create a content type "daily schedule" and attach multiple events to it (like 14:00 Gym, 16:00 Beer with friends), I would propose Field collection. It would allow you to group time field (either simple numerical field or Time field with text field.
Hope that helped!
I will suggest you to go with contributed module intended to handle this kind of requirement. As per my understanding, you want to make functionlity for user to create their TODO list & there is a module which can do it easily for you - myTinyTodo.
Otherwise above answer is also good option to use field_collection.
I would suggest content type + date module + calendar module.
install & enable Date Module. You will be able to add a date field to content type
Add new content type "Task"
Add 2 date fields "start" (2PM) and "end" (4PM) to your content type.
Users will be able to add as many tasks as they want.
And finally, you can use Calendar module to preview task's list.

Function for Google Feeds API to skip entries?

Is there a way to call the Google Feed API so that it skips X number of entries in a feed?
To explain the context:
I'd like to load additional entries on demand from a particular feed. So a user can click a "Load more" type button, and an ajax function fires to retrieve additional entries. Just to put some numbers on the scenario, lets say I load 10 entries by default, and want to load an additional 10 each time a user clicks on a "load more" button.
With the historical entries / numEntries API functions, I can essentially solve my problem by retrieving 10 + ( number of entries already loaded ), and only output the last 10. But this is pretty ugly, because every time a user loads another 10 entries, they have to load ALL the previous entries as well, so the load gets larger everytime they load more entries. Seems pretty inefficient!
Inspecting the API docs at Google, I couldn't find any reference to a "skip entries", or "start from X entry" type of API method / variable, so I could make my ajax call nice and lean, and just get 10 entries, starting from ( number of entries already loaded).
Anybody have any experience / suggestions for me?
I think you'll have to load all items first, but only display 10 at first. If they click "show more" you then show them the next 10 (you'll have to keep an internal pointer of your position in the list of items). So essentially, you aren't "loading" 10 more, you're "showing" 10 more.

Attaching AJAX to Drupal Forms API Date Field

I am developing a Drupal form which includes a Date field.
I have a number of AJAX callbacks on this form that work well, but now I want to change some form elements depending on the age of the user, so when the date changes, other fields get replaced. Unfortunately, the "#ajax" element is not available on date fields (presumably because the field has three selects, rather than a single select).
Is there another way I can implement an AJAX callback?
I'm considering splitting the date field into 3 selects, which could each have an AJAX element, but that would lose all the benefits of the date field, so I don't want to unless I have to.
Thanks for your help,
James

ASP.NET convert string to pre-defined length string

Here at work we are converting over to a new payment system which allows only a maximum of 7 characters in the product code. The product codes we are using can and will excede 7 characters (changing would require changing past orders so changing the codes is out of the question).
The product code for us is the event code (ie ccsws2011), the old system allowed us to pass the entire event code in, whereas the new system is limiting us to only 7 characters. I do not want to do a look up table at all. I want to be able to create a product code list for the system (outside the website) and then have the code within the website automatically convert our event code to the product code I created outside the website and pass it to the payment system.
Is there a way to hash our product code into a 7 character product code for the new system?
I.E.:
our product code: ccsws2011
Hashed product code: xxxxxxx
Thanks for your efforts everyone, another value was decided upon to be used for the item code which nullified this issue. Thank you again everyone

Resources