mercredi 29 juin 2016

Silverstripe better form looking on templates

I have a designed template on photoshop from a client. My interrogation... When I saw the template is: Can I put 2 fields side-by-side? I want to have f_firstname and f_lastname on one row... Is there anyway to inject tags or piece of code with classes like ex: div="column1of2" $field_here close div to have a 2 columns for 2 fields?

Actually, code generate each fields are on separates rows. That's not very pretty. Possible?

I have this code :

private static $allowed_actions = array(
    'FormInfolettre'
);

public function FormInfolettre() {
    $fields = new FieldList(
        EmailField::create('f_email', 'Votre courriel'),
        TextField::create('f_firstname', 'Votre prénom'),
        TextField::create('f_lastname', 'Votre nom'),
        TextField::create('f_message', 'Votremessage'),
);

    $actions = new FieldList(
        FormAction::create("Soumettre")->setTitle("Soumettre")
    );

    $required = new RequiredFields(
        array(
            'f_email',
            'f_firstname',
            'f_lastname',
            'f_message',

        ));

    $form = new Form($this, 'FormInfolettre', $fields, $actions, $required);

    return $form;
}

Aucun commentaire:

Enregistrer un commentaire