Hello,
Moodle version 2.4.3+ (Build: 20130328)
PHP version 5.3.10
I'm new to Moodle and programming in general, so I hope someone is able to understand my problem. I've been struggling with it all day. Time to ask for help. I can post more code if it helps.
I am hoping to add a bit of new functionality to the Booking module.
What I have done so far:
- Edited mod_form.php to add a new area for text entry
function definition(){
$mform->addElement('header', '', 'Location','booking');
$mform->addElement('text', 'postcode', 'Postcode', array('size'=>'64'));
- Updated the install.xml file using the XMLDB editor
Added column "postcode" type "text".
- Added the following to booking_add_instance($booking)& booking_update_instance($booking) in lib.php
$booking->postcode = $booking->postcode['text'];
- Then in view aded this to see if my input is being correctly stored
echo $booking->postcode;
------------------------------------------
The new text entry box is now apparent in the booking page. Using Firebug, I can see the correct variable is being passed to modedit.php (eg. BN24QX), but on the booking confirmation, the output from that echo is just 'B'. I have used mysql client to check the booking table, and it shows up as 'B' there also.
When I stick a print_r ($booking->postcode) in the function booking_add_instance($booking) in lib.php, I still just get 'B'.
So my text seems to be getting truncated somewhere between modedit.php and lib.php. I took a look at modedit, but can't figure it out.
Any help would be greatly appreciated.
Neil