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 |
Maybe you don't even need that.
html div onClick: (html jQuery ajax callback: [ :var | var halt] value: (JSStream on: 'detectHtmlDate5()') ); with: 'testing'. var is 'true' when I click on this. So, something like this could tell you what to render next. Alternately, the onload code could store the result in a js var which gets returned by the above method when user clicks. Cheers, Bob On 2/3/14 11:00 AM, Sabine Knöfel
wrote:
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? _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Hi Bob,
thank you. This helps. I use your code within the login screen and save the result in the session. Regards Sabine On Mon, Feb 3, 2014 at 5:36 PM, Bob Arning-2 [via Smalltalk] <[hidden email]> wrote:
|
Free forum by Nabble | Edit this page |