Jump to content

Recommended Posts

Posted

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

Posted

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!

Posted

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.

Posted

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 :)

Posted

Somewhat more "elegant" way:

$form->insertAfter($submit, $form->find("type=submit")->last);

Thanks for reminding that $form is actually WireArray

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...