I'm trying to extent the paypal widget to include 3 checkboxes. I have added them to the CMS screen ok, but when I tick them this isn't saved. On looking at the cms page code (View Source) I can see that the checkboxes don't actually have a "value" attribute, eg:
<input type="checkbox" id="Widget[3][CheckboxValue]" name="Widget[3][CheckboxValue]" />
My code is as follows...
class PayPalWidget extends Widget {
static $db = array('Currency' => 'Varchar(5)', 'Business' => 'Varchar', 'Text' => 'Varchar(255)', 'Amount' => 'Varchar', 'ButtonText' => 'Varchar', 'CheckboxValue' => 'Boolean', 'CheckboxValue2' => 'Boolean', 'CheckboxValue3' => 'Boolean'
);
static $defaults = array('Currency' => 'GBP', 'Text' => 'Pay with PayPal', 'Amount' => 'Amount to Pay', 'ButtonText' => 'Pay Online');
static $title = "";
static $cmsTitle = "Paypal button";
static $description = "Adds a button that allows users to pay with PayPal";
function getCMSFields() {
return new FieldSet(
new TextField('Currency', _t('PayPalWidget.CURRENCY', 'The currency the donation should be in'), '', 5),
new TextField('Business', _t('PayPalWidget.BUSINESS', 'Your PayPal account')),
new TextField('ButtonText', _t('PayPalWidget.BUTTONTEXT', 'Button text')),
new TextField('Amount', _t('PayPalWidget.AMOUNT', 'Amount to Pay')),
new TextField('Text', _t('PayPalWidget.TEXT', 'A short description of the payment that is displayed on your statement.')),
new CheckboxField('CheckboxValue', _t('PayPalWidget.CHECKBOXVALUE', 'Add extra info box')),
new CheckboxField('CheckboxValue2', _t('PayPalWidget.CHECKBOXVALUE2', 'Add Chain Size Option')),
new CheckboxField('CheckboxValue3', _t('PayPalWidget.CHECKBOXVALUE3', 'Add Ring Size Option')));
}
Can anyone see what's missing?