Mike Rockett Posted January 9, 2015 Share Posted January 9, 2015 How do I accomplish the following in a form? 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... Link to comment Share on other sites More sharing options...
Mike Rockett Posted January 9, 2015 Author Share Posted January 9, 2015 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? Link to comment Share on other sites More sharing options...
LostKobrakai Posted January 9, 2015 Share Posted January 9, 2015 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; } Link to comment Share on other sites More sharing options...
Martijn Geerts Posted January 9, 2015 Share Posted January 9, 2015 (edited) 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 January 9, 2015 by Martijn Geerts 2 Link to comment Share on other sites More sharing options...
Mike Rockett Posted January 9, 2015 Author Share Posted January 9, 2015 Ah, right (was definitely not looking in the right places)... Would be nice if it was built in: $button->addClass('ui-button-float-right'). 1 Link to comment Share on other sites More sharing options...
kongondo Posted January 9, 2015 Share Posted January 9, 2015 (edited) 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 January 9, 2015 by kongondo 2 Link to comment Share on other sites More sharing options...
Mike Rockett Posted January 9, 2015 Author Share Posted January 9, 2015 I've just done an ->addClass(), which seems better to me, and it does work... 3 Link to comment Share on other sites More sharing options...
kongondo Posted January 9, 2015 Share Posted January 9, 2015 Indeed it is cleaner...updated my post.. Martijn was right Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now