[eluser]seanloving[/eluser]
[quote author="macigniter" date="1266615966"][quote author="seanloving" date="1266613031"]
THE LABEL DOES NOT MOVE when I change the label postition to 'after'.
[/quote]
Of course you also need to update the stylesheet if you want the labels to be floating to the right. Check out the HTML and you will see that the <label>s will indeed be
after the <input> element.
[quote author="seanloving" date="1266613031"]
The only thing that happens is that the single * becomes a double **. However, the double asterisked label remains in the 'before' position.
[/quote]
Can you please post a sample snippet of the element you are creating with FGL? There is a bug with double prefixes/suffixes if you use the ->label() method. I am just updating the library and want to make sure there's nothing more to it... so please help me by posting some example. Thanks!
EDIT: Please don't forget to post a snippet of your form.php config file (the part in the $config['defaults'] regarding 'label')[/quote]
EXAMPLE 1
I attached a screenshot of what your demo form looks like when I make two small changes to the default settings of the config file:
Code:
$config['defaults'] = array(
'label' => array(
'position' => 'after',
'class' => 'right',
'required_class' => 'required',
'required_flag' => '*'
),
Please notice that the position is 'after' but looking at the screenshot you see the labels are 'before'. Where is the CSS that controls this?
EXAMPLE 2
here is the config/form.php snippet:
Code:
$config['defaults'] = array(
'label' => array( // all label configuration is done here now!!
'position' => 'before',
'class' => 'right',
'required_class' => 'required',
'required_flag' => '*'
),
I was following a previous example you gave about how to use the ->col() method. Here is my entire form:
Code:
$this->form->open('contacts/'.$action)
->hidden('contact_id', $this->input->post('contact_id'))
->fieldset( ($action=='add') ? 'Add New Contact' : 'Edit Contact Details' )
->col(150, 'left', 'right')
->label('First/Last Name', 'name')
->label('Street', 'address-1')
->label('City/State/Zip', 'state' )
//->label('Country', 'country' )
->label('Telephone', 'telephone' )
->label('Email', 'country' )
->label('Notes', 'notes' )
->col()
->text('firstname', '', 'required|trim|max_length[50]', $this->input->post('firstname'), array('element_suffix'=>'','class'=>'combine','style'=>'width:100px'))
->margin(20)
->text('lastname', '', 'required|trim|max_length[50]', $this->input->post('lastname'), array('class'=>'combine','style'=>'width:100px'))
->margin(4)
->text('address1', '', 'required|trim|max_length[50]', $this->input->post('address1'), array('style'=>'width:217px'))
->margin(20)
->text('city', '', 'required|trim|max_length[40]', $this->input->post('city'), array('element_suffix'=>'','class'=>'combine','style'=>'width:100px'))
->margin(20)
->text('state', '', 'required|trim|max_length[2]', $this->input->post('state'), array('element_suffix'=>'','class'=>'combine','style'=>'width:23px'))
->margin(14)
->text('zipcode', '', 'required|trim|max_length[5]', $this->input->post('zipcode'), array('style'=>'width:40px'))
->margin(12)
->hidden('country', 'USA')
->margin(20)
->text('telephone', '', 'required|trim|max_length[10]', $this->input->post('telephone'), array('style'=>'width:75px'))
->margin(20)
->text('email', '', 'required|trim|max_length[50]', $this->input->post('email'), array('style'=>'width:217px'))
->margin(20)
->text('notes', '', 'trim|max_length[250]', $this->input->post('notes'), array('style'=>'width:217px'))
->margin(20)
->submit( ($action=='add') ? 'Add Contact': 'Update this Contact', $action )
->margin(20)
->model('contacts_model', $action.'_contact') // writes to database if valid, otherwise sets a form submission error
->validate();
When I change position to 'after' then all the required fields get a double asterisk.
I want to generate the same form WITHOUT using the ->label(). Please confirm that should be possible and easy.
Thanks