Jump to content

The ultimate community for Ruby on Rails developers.


Photo

Error layout


  • Please log in to reply
2 replies to this topic

#1 Jorge

Jorge

    Passenger

  • Members
  • 3 posts

Posted 29 August 2013 - 07:58 PM

Hi all,

 

I have created a form to insert new records (see "Selección_001.png") with two mandatory fields ("name" and "surname") but if I try to insert a blank record (so it is invalid) I get the two errors (that is correct) but the page layout is modified (see "Selección_002.png"), which is not correct.

 

As you can see "Name" label, "name" text box, "Surname" label, and "surname" text box are moved each one to a new line (which is different from to original layout)

 

I have tried to delete ALL css files on the folder but without success ("Selección_003.png"), the red color disappears but the layout is still modified ;-(

 

Does anybody know what file I have to update to avoid this change in my layout?

 

Thanks!

 

        Jorge

 

 

Attached Thumbnails

  • Selección_001.png
  • Selección_002.png
  • Selección_003.png


#2 Jamie

Jamie

    Controller

  • Moderators
  • 114 posts
  • LocationThe UK

Posted 29 August 2013 - 08:09 PM

Hi man

 

This is most likely happening because you're using a scaffold css file in your assets/stylesheets folder.

 

It usually contains css for .field_with_errors which contains display: table I think...

 

That'll be what's causing it mate.

 

If not, right click and inspect element, highlight the input and see what CSS is applied and which file it belongs to.

 

 

:)


Rails developer based in Newcastle, UK.
Web app owner - Twitter lover

#3 Jorge

Jorge

    Passenger

  • Members
  • 3 posts

Posted 29 August 2013 - 09:04 PM   Best Answer

Thanks Jamie!

You are right! The "issue" was on HTML code: each faulty HTML tag was being wrapped inside a new <div>, so the default behavior was to start a new line.

I have added "display:inline-block" in the CSS class and everything is working perfect now.

Thanks!!






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users