Jump to content
Mike Rockett

Secondary buttons in a form

Recommended Posts

How do I accomplish the following in a form?

post-2289-0-39881300-1420809437_thumb.pn

Buttons as shown in the Fields listing

I need the buttons on the left and right. After having a look at the code for InputfieldButton, I don't think it's possible. But there has to be a decent way of doing it...

Share this post


Link to post
Share on other sites

Unless I render each one out to a string, and then send the complete string back? But then how would I get them to float to the right?

Share this post


Link to post
Share on other sites

Simply have a look in ProcessTemplate. There's simply no extra markup, it's just css.

#export_button, #import_button {
  float: right;
  margin-left: 0.25em;
}

Share this post


Link to post
Share on other sites

Can't you just set the class ?

$button = wire('modules')->get('InputfieldButton');
$button->attr('class', 'ui-button ui-widget ui-state-default ui-corner-all align-me-right'); 
 
Didn't test it but looks like: $button->addClass('align-right'); should do the trick.
Edited by Martijn Geerts
  • Like 2

Share this post


Link to post
Share on other sites

Ah, right (was definitely not looking in the right places)... Would be nice if it was built in: $button->addClass('ui-button-float-right').

  • Like 1

Share this post


Link to post
Share on other sites

It is built in. Martijn was close right. You can do this:

$button = $this->modules->get('InputfieldButton'); 
$button->attr('id', 'button_create'); 
$button->attr('value', $this->_('Create New')); 
$button->attr('href', './edit/'); 
$button->class .= ' my-float-right-class';//note: concatenation + space

PW will add the other inbuilt button classes.

//See a cleaner alternative below...

Edited by kongondo
  • Like 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...