Forums | Mahara Community
Developers
/
put two buttons side by side
30 October 2017, 19:58
Hi everyone,
i have a question regarding as the subject above. Is it possible to put two button side by side in a form using mahara template?
For example, i want to put button 'BACK' and 'SAVE' in a form. Below is the coding to display the 'SAVE' button:
pieform(array(
'name' => 'personalinformation',
'plugintype' => 'artefact',
'pluginname' => 'resume',
'jsform' => true,
'method' => 'post',
'class' => 'form-group-nested',
'elements' => array(
'studentname' => array(
'type' => 'text',
'defaultvalue' => param_integer('id'),
'title' => get_string('studentname', 'artefact.resume'),
'size' => 30,
'readonly' => true,
),
'appraisal' => array(
'type' => 'wysiwyg',
'rows' => 10,
'cols' => 50,
'rules' => array('maxlength' => 65536),
'title' => get_string('appraisal', 'artefact.resume'),
),
'save' => array(
'type' => 'submit',
'value' => get_string('save'),
'class' => 'btn-primary'
),
),
));
Really appreciate if someone can help me. Thank you..:)
31 October 2017, 7:53
Hi Noraini
You just need to replace your 'submit' button with a 'submitcancel' one, so you just need to change this bit:
'save' => array(
'type' => 'submit',
'value' => get_string('save'),
'class' => 'btn-primary'
),
to this:
'save' => array(
'type' => 'submitcancel',
'value' => array(get_string('save'), get_string('back')),
'goto' => get_config('wwwroot') . 'path/to/return/to.php',
),
Cheers
Robert
31 October 2017, 8:33
Hello Noraini,
And if you are looking for the correct styling of your buttons, you can check out the style guide. You can reach it by going to wwwroot/theme/styleguide.php It contains the majority of our available styles. There are a few buttons that will need to be added.
Cheers
Kristina