Percentage based form fields

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

StuartF
Ebase User
Posts: 14
Joined: Thu Sep 26, 2013 11:35 am

Percentage based form fields

#1

Postby StuartF » Thu Sep 26, 2013 11:55 am

This probably a very silly question to all you ebase gurus but how can we go about setting up a form where any text fields are % (elastic) within the parent container i.e. they adapt to the browser width.

We have a requirement to use a Jello Mould type of layout for our forms and up to now all attempts have failed ,including setting up custom CSS styles which work on everything apart from the width?.
0 x

AJDulk
Ebase User
Posts: 94
Joined: Fri Sep 14, 2007 12:18 pm
Location: The Netherlands
Contact:

Re: Percentage based form fields

#2

Postby AJDulk » Thu Sep 26, 2013 12:51 pm

This is not a silly question at all. I am not sure this can be done easily in Ebase, it may take hand-made JavaScript to strip Ebase generated field widths from the form at runtime - which is only really handy when the user has it switched on (which is most). I am interested to see Ebase's response to this.
0 x

User avatar
Wai
Moderator
Moderator
Posts: 165
Joined: Wed Sep 12, 2007 9:04 am
Location: Sandy, UK
Contact:

#3

Postby Wai » Thu Sep 26, 2013 4:31 pm

You can get it to work by applying the width in CSS on the field.

First you need to understand the HTML generated by Ebase for a Field control.

Code: Select all

<div>
  <div>
  <label>Email</label>
  </div>
  <div>
  <input>
  </div>
</div>
You can see there is a <div> around the <label> and a <div> around the <input>.
There is also a parent <div> for the whole field control.

You need to place your width (% or em) on the parent <div> as well as the <div> around the <input> and also on the <input> itself.

For example:
Parent <div> could be 100%
Input <div> could be 80% (leave some width for the label)
<input> could be 100%

How to do this in Ebase

1. Open Control Style for the field
2. On the Field tab, click Advanced Properties
3. Open the Style popup
4. Enable local setting
5. On the Code tab, add width property style

This will add the width to the parent <div>
Repeat 2 - 5. for the Editor Cell tab
On the Editor Cell you have to apply a width to both the Style (div) and Input Style (input)

You can apply a class which sets the width instead of step 4. Enable local setting, and also save as a property set to reuse.

Hope that helps.
Last edited by Wai on Tue Oct 01, 2013 8:23 am, edited 1 time in total.
0 x

StuartF
Ebase User
Posts: 14
Joined: Thu Sep 26, 2013 11:35 am

#4

Postby StuartF » Tue Oct 01, 2013 7:58 am

Cheers we managed to get this working
0 x


Who is online

Users browsing this forum: No registered users and 6 guests