Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Form Questions

Custom FieldGroup ID


Reply

2 Posts   1642 Views

Avatar
zenmonkey

2 September 2009 at 9:00am (Last edited: 2 September 2009 9:01am), Community Member, 528 Posts

Is it possible to to set manually the FieldGroup ID (in a custom form) so its not a string of the Fields it contains?

Here is my FieldSet

$fields = new FieldSet(
                      new FieldGroup (
                                  new HeaderField('Personal Information', 3),
                                  new LabelField("explanation","To Set-up Your Account"),
                                  new TextField('FirstName', 'First Name'),
                                  new TextField('Surname','Last Name'),
                                  new EmailField('Email'),
                                  new ConfirmedPasswordField('Password')
                                  ),
                      new FieldGroup (
                                  new HeaderField('Company Information', 3),
                                  new LabelField("explanation","To Verfiy Eligibility"),
                                  new TextField('CompanyName','Company Name'),
                                  new DropdownField('CompanyType','Company Type',$companyTypeList),
                                  new TextField('CompanyURL','Company Website'),
                                  new TextField('HomePhone','Company Phone'),
                                  new TextField('Address','Address'),
                                  new TextField('AddressLine2','Address Line 2'),
                                  new TextField('City','City'),
                                  new TextField('State','State or Province'),
                                  new TextField('Country','Country'),
                                  new TextField('TaxIDNumber','TaxIDNumber'),
                                  new TextField('Distributor','Distributor'),
                                  new TextField('SalesRep','Sales Rep'),
                                  new TextareaField('Notes','Description'),
                                  new HiddenField('PageID', '', $this->ID)
                                  )
);

Avatar
beezer

14 June 2011 at 4:17am Community Member, 16 Posts

Old post but came up in Google when I tried to do the same thing so here goes:

$billingAddress = new FieldGroup(
new TextField("FullName", _t('AddressForm.ADDRESSNAME', 'Full Name'), _t('AddressForm.ADDRESSNAME')),
new TextField("Address1", _t('AddressForm.ADDRESS1', 'Street'), _t('AddressForm.ADDRESS1')),
new TextField("Address2", _t('AddressForm.ADDRESS2', 'Street 2'), _t('AddressForm.ADDRESS2')),
new TextField("Address3", _t('AddressForm.ADDRESS3', 'Street 3'), _t('AddressForm.ADDRESS3')),
new TextField("City", _t('AddressForm.CITY', 'City'), _t('AddressForm.CITY')),
new TextField("Postcode", _t('AddressForm.POSTCODE', 'Postcode'), _t('AddressForm.Postcode')),
new DropdownField('Country', _t('AddressForm.COUNTRY', 'Country'), $countries)
);
$billingAddress->setID('BillingAddress');

$fields = new FieldSet(
$billingAddress,
new FieldGroup(
new TextField("CardNumber", _t('AddressForm.CARDNUMBER', 'Card Number'), _t('AddressForm.CARDNUMBER')),
new DropdownField('CardExpiryMonth', _t('AddressForm.CARDMONTH', 'Expiry Month'), $months),
new DropdownField('CardExpiryYear', _t('AddressForm.CARDYEAR', 'Expiry Year'), $years)
)
);