[Seaside] how can I use result of onLoad() javascript function in session or view

Sabine Knöfel sabine.knoefel at gmail.com
Mon Feb 3 16:00:39 UTC 2014


Hi,

short version of my question:

how can I use the result of a javascript function which is called onLoad
within my smalltalk code? Eg. set the result in an inst var of view or
session?

Long version/explanation:

I want to render different html date widgets depending on the browser
support.
Exactly, I want to render html5 input types if the browser supports them.
http://www.hongkiat.com/blog/html5-form-input-type/

If not (many browsers do not support them), I will use my existing JQuery
datepicker solution.

Background is, that for mobile, I want to use the html5 widgets, where you
can use scroll wheels to select dates and not the jquery calendar.

For this, I have a Javascript function which is called onLoad (later
possibly modernizr). 
It works, it returns true if html5 date widget is supported and false if it
is not supported.

'function detectHtmlDate5 () { 
var i = document.createElement("input");
i.setAttribute("type", "date");
return i.type == "date";
};
'
(http://diveintohtml5.info/detect.html#input-types)

I call it by adding the js code in the updateRoot: 
aHtmlRoot javascript url: theLibraryName / #rkaJs.

and calling it within renderContentOn: of the main view

html document addLoadScript: (html javascript add: (JSStream new
		nextPutAll: 'detectHtmlDate5()';
		yourself)).	

This works, because if I add an alert() within the javascript function; the
alert shows true or false when loading the page.

But I have no idea how to get the result into my session or my view.

I hope the problem is clear and someone having an answer for me.

Sabine








--
View this message in context: http://forum.world.st/how-can-I-use-result-of-onLoad-javascript-function-in-session-or-view-tp4741219.html
Sent from the Seaside General mailing list archive at Nabble.com.


More information about the seaside mailing list