How to add phone number field to simplereservation/add page I have installed the simplereservation module. I can add a reservation by visiting xxx.com/simplereservation/add page. I do not see phone number field on that page. How to add phone number field to the add page?



I think comment field is needed. I copied the comment form and pasted there. Then I edited the form for phone number as below:

  $form['phone'] = array(
    '#type' =&gt; 'textfield',
    '#size' =&gt; 50,
    '#title' =&gt; t('phone'),
    '#default_value' =&gt; $reservation["rcomment"],
    '#description' =&gt; t('You can add a phone for your reservation.'),
  );


When I go to simplereservation/add page, I do see the comment, phone number field plus other fields. However, after I enter the reservation info plus the phone number, I click Save this reservation. On the reservation page, I see other info except the 'phone number' + 'this reservation is for'. How can I see the phone number on the reservation page?



I have not learned how to use hook yet.

I did look at the simplereservation.install file and i saw how comment filed is defined in simplereservation_schema(). I simply copied the comment code and modified for phone field as below:

 'rcomment' =&gt; array(
    'description' =&gt; 'Text comment that accompanies the reservation',
    'type' =&gt; 'varchar',
    'length' =&gt; 255,
    'not null' =&gt; TRUE,
    'default' =&gt; '',
  ),
    'phone' =&gt; array(
    'description' =&gt; 'phone no of customer',
    'type' =&gt; 'varchar',
    'length' =&gt; 25,
    'not null' =&gt; TRUE,
    'default' =&gt; '',
  ),


I still see the phone field add page not on the reservation page. 




In sr.module > i have added 

$form['phone'] = array(
'#type' =&gt; 'textfield',
'#size' =&gt; 50,
'#title' =&gt; t('phone'),
'#default_value' =&gt; $reservation["myphone"], 
'#description' =&gt; t('You can add a phone for your reservation.'),


);
In sr.install

'phone' =&gt; array(
'description' =&gt; 'phone no of customer',
'type' =&gt; 'varchar',
'length' =&gt; 25,
'not null' =&gt; TRUE,
'default' =&gt; '',


),
Disabled the module > Uninstalled the module > Cleared the cachse > Enabled the module > Created 2 items bc items were gone.
xxx.com/sr/add


Error:
Notice: Undefined index: myphone in 
simplereservation_add_edit_form() (line 545 of ..../sites/all/modules/simple_reservation/simplereservation.module).

line 545:

   '#default_value' =&gt; $reservation["myphone"], 


Please advise.
I think if you don't want to edit module, you may use comment field for telephone number. It's much easier to customize comment label and change it to phone number, than to edit module's code for additional field to store in database and display in form. Anyway it will be your preference.

UPD: tried to do something. If you don't need user comment, you can change Comment label, make it required field, and change description. (better solution is to try alter form)

Result: 

Where to replace code in sites/all/modules/simple_reservation/simplereservation.module:



You just can compare lines from original and my example.