3

I need to create a booking form for an event. This form will contain normal text field plus one drop down list with the number of tickets. There will be a prefilled field with the price of the single ticket that user can modify. After the field with the price of the single ticket there will be an other field with the total price of the tickets and when they select the number of the tickets automatically the total price will be updated and stored in the database after the form is submitted. After the submit I need to send an email, I can use mime-mail but let me know if I need to change method due the live field of the prices.

There is not online payment expected.

Let me know if everything is clear.

2
  • Do you have a limited number of seats or other restrictions?
    – mpdonadio
    Mar 15, 2012 at 13:57
  • No, we don't have any seat or other restriction. Mar 15, 2012 at 13:59

3 Answers 3

1

If you're new to Drupal, I would first try the webform module. This is a very popular, well tested module that often gets security fixes which less commonly used modules may not get.

It has all the basic functions you need for creating the options for the form and can easily be configured to send an e-mail upon submission. It will also leave a record of all submitted data in the Drupal database.

To be honest, off the top of my head I'm not sure if webform can do the computation you request or not. However, for that there is the computed field module, which will allow you to write a simple function in PHP to compute the value. Alternately, you could use the rules module's "on node save" event with the action "compute data value" to calculate the total price.

There are a number of other approaches as well but these are commonly used Drupal modules with fairly good documentation and thus are, I think, a good place to start.

1
  • Hi Patrik, thanks for your response. I;m not new with drupal, actually I'm using the webform module but the problem is the live calculation. I'm trying to combine webform and jquery to make it work. I'm looking for the API who reads live a field. Mar 15, 2012 at 14:23
1

I've solved it throught jQuery. I had 3 fields involved. One select, one text field and one text field readonly.

The select defines the number of the tickets, the textfield contains the price of the ticket and the readonly field contains the total price.

I want to update automatically the readyonly field everytime the user changes the select or the textfield with the price. So I did in this way.

 jQuery(function(){
function display() {
 var ticket =  jQuery('#ticket').val();
var price =  jQuery('#price').val();
var totalPrice = ticket * price;
jQuery('input[id=totalprice-readonly]').attr(
        {value: totalPrice});
}
jQuery('#ticket').change(display);
display();
jQuery("#price").keyup(function () {
      var price = jQuery(this).val();
 var ticket =  jQuery('#ticket').val();
var totalPrice = ticket * price;
jQuery('input[id=totalprice-readonly]').attr(
        {value: totalPrice});
    }).keyup();

});

This is the way how I did. It works properly, it just needs to be completed (thousand separetor and decimal).

All the suggestions are welcome.

0

Check the Booking Time Slots module, or see Comparison of Booking System modules.

Module provides Time Slots Booking functionality.

For example:

  • Users can go to Calendar and book specified time slots
  • You can configure how many time slots are available and how long are the events, so after that time slot will be released
  • You can configure hourly and half-hourly time lots (in calendar view)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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