Client Screen Resolution

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

User avatar
Jez
Ebase User
Posts: 31
Joined: Thu Aug 21, 2008 11:03 am
Location: Hampshire County Council

Client Screen Resolution

#1

Postby Jez » Thu Oct 23, 2008 9:36 am

Hi,

I'm trying to get the users IE screen resolution at run-time, so I can decide in fpl on a course of action to take regarding presentation.

Is there an ebase in-built way of detecting the client IE screen resolution? If not, I can determine the screen height & width using javascript by using;

screen.width and screen.height

If there isn't an ebase in-built function for getting the screen height & width (in pixels) is there a way of passing this info into an ebase filed if I call the javascript from the form properties; HTML++ section?

Hope this makes sense. Thanks,
Jez
0 x
--------------------------------------
Jez Hollinshead - Hampshire CC

User avatar
Joost
Ebase User
Posts: 49
Joined: Fri Sep 14, 2007 6:14 pm
Location: The Netherlands

Re: Client Screen Resolution

#2

Postby Joost » Thu Oct 23, 2008 12:30 pm

Jez wrote:is there a way of passing this info into an Ebase filed if I call the javascript from the form properties
Use JavaScript to set the uservar formfields. Trigger form submit with javascript function.
http://portal.ebasetech.com/cp/doc/Pane ... action.htm
0 x

User avatar
Jez
Ebase User
Posts: 31
Joined: Thu Aug 21, 2008 11:03 am
Location: Hampshire County Council

#3

Postby Jez » Fri Oct 24, 2008 8:17 am

Hi,

Thanks for your reply Joost.

My javascript knowledge is unfortunately fairly poor, but the instructions linked to above seem to be for passing a variable into the ebase $USERVAR1 variable, when a button is clicked on a non-ebase section of a form (e.g. a JSP). Have I understood this correctly?

I need to automatiacaly set the variable when the form loads, rather than when a user clicks a button. I do have a LEFT and a TOP JSP on my form, but if I'm not actioning the set when a button is pressed, do the JSP's need to be involved in this process?

If I put the following java script into the HTML++ section of the ebase form I call, I get an alert pop up showing me my screen width as anticipated;

Code: Select all

<script>
  alert&#40;screen.width&#41;;
</script>
However, if I try setting the $USERVAR1 field from here (as follows)

Code: Select all

<script>
  setFieldValueExternal&#40;"$USERVAR1","test"&#41;;
</script>
I get a javascript error when the page loads;
'documents.RW.elements' is null or not an object

Does anyone have any advice?
0 x
--------------------------------------
Jez Hollinshead - Hampshire CC

User avatar
Joost
Ebase User
Posts: 49
Joined: Fri Sep 14, 2007 6:14 pm
Location: The Netherlands

#4

Postby Joost » Mon Oct 27, 2008 7:15 am

Jez wrote:I need to automatiacaly set the variable when the form loads, rather than when a user clicks a button.
This is possible with the javascript functions. No user interaction needed.

'documents.RW.elements' is null or not an object
Ah... ok. use bottom.jsp. Following code should do the trick.

Code: Select all

<script>
  setFieldValueExternal&#40;"$USERVAR1","test"&#41;;
  externalSubmit&#40;&#41;;
</script>
0 x


Who is online

Users browsing this forum: No registered users and 126 guests