Stikki Posted May 26, 2015 Share Posted May 26, 2015 Hello again, Tried to make module today that adds exit and exit + save buttons, but came to conclusion that hidden fields are on the way Solution is simple: never add hidden fields before visible output, or don't include em as block type elements at all (CSS). So example in ProcessPageEdit::___buildForm : Instead of: if($saveName) { $submit = $this->modules->get('InputfieldSubmit'); $submit->attr('id+name', $saveName); $submit->attr('value', $saveLabel); $submit->addClass('head_button_clone'); $form->append($submit); } if($submit2) $form->append($submit2); /* if($this->input->get->modal && $this->page->className() == 'Page') { $submit = $this->modules->get('InputfieldSubmit'); $submit->attr('name', $saveName); $submit->attr('id', 'submit_save_top'); $submit->attr('value', $saveLabel); $form->append($submit); } */ $field = $this->modules->get('InputfieldHidden'); $field->attr('name', 'id'); $field->attr('value', $this->page->id); $form->append($field); return $form; To: $field = $this->modules->get('InputfieldHidden'); $field->attr('name', 'id'); $field->attr('value', $this->page->id); $form->append($field); if($saveName) { $submit = $this->modules->get('InputfieldSubmit'); $submit->attr('id+name', $saveName); $submit->attr('value', $saveLabel); $submit->addClass('head_button_clone'); $form->append($submit); } if($submit2) $form->append($submit2); /* if($this->input->get->modal && $this->page->className() == 'Page') { $submit = $this->modules->get('InputfieldSubmit'); $submit->attr('name', $saveName); $submit->attr('id', 'submit_save_top'); $submit->attr('value', $saveLabel); $form->append($submit); } */ return $form; Or something similar. Dunno if this is correct place for stuff like this, if not please redirect me to correct forum for future. Module works fine btw It's just visuals bothers me. Cheers Link to comment Share on other sites More sharing options...
LostKobrakai Posted May 26, 2015 Share Posted May 26, 2015 Just use insertAfter / insertBefore if you need buttons to not be appended after the hidden input: https://processwire.com/talk/topic/9832-how-to-create-an-action-in-an-admin-page/?p=94500 1 Link to comment Share on other sites More sharing options...
Stikki Posted May 26, 2015 Author Share Posted May 26, 2015 Correct Mr Kobra, but this requires some process mapping, etc. Would be cool if hidden fields would be not present at any visual presence at all, but this has to do for now, thanks a lot! Link to comment Share on other sites More sharing options...
LostKobrakai Posted May 26, 2015 Share Posted May 26, 2015 It's actually not the really the hidden field in this case but this rule: .Inputfields .Inputfield:not(.InputfieldSubmit)+.InputfieldSubmit{ clear:left; } This will hit no matter of the visual setting of the hidden field. Link to comment Share on other sites More sharing options...
Stikki Posted May 26, 2015 Author Share Posted May 26, 2015 Yup, like stated before it's CSS "issue". But field could as well be positioned better in WireArray. Anyways i'll use process mapping for now, but just my 50 cents Link to comment Share on other sites More sharing options...
Stikki Posted May 26, 2015 Author Share Posted May 26, 2015 Somewhat more "elegant" way: $form->insertAfter($submit, $form->find("type=submit")->last); Thanks for reminding that $form is actually WireArray 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