06-12-2012 01:32 PM
Hi everyone!
In my app, I want the user to select a date using the PB browser date selector "dialog".
What I'm trying to do is that by pressing a button, that dialog should popup. But I can't seem to be able to do it. The dialog only appears if the user manually clicks on the date input field.
I tried send focus(), click() and select() , they work but dont trigger the date dialog.
Is this possible?
thanks
06-12-2012 06:36 PM
Hi there,
If you check out the dialog_dispatcher.js file that is included with your WebWorks SDK; example:
...\BlackBerry WebWorks SDK for TabletOS 2.2.0.5\bbwp\ext\blackberry.ui.dialog\js\common\di
You can see some references to generateRequest and requestDialog. It may be possible to trace those through to the core functionality and hack something together. From the code though, it does seem to be that a click event should trigger the dialog. I'll play around with this some to see if I can get it working here.
06-13-2012 05:52 PM
Hi Erik,
Thanks for the comment!
Didn't find anything useful so far. My guess is that this is not webworks related, is how the webkit behaves... probably in some normal webpage the same thing would happen. Maybe someone from the playbook webkit could give a hint on how to trigger it? Any devs around here?
Thanks!
nuno
06-14-2012 07:18 AM
<script type="text/javascript">
function onDateTimeSelected(datetime){
alert(datetime);
}
//Input argument is a reference to an input control of type: date, datetime, datetime-local, month, time
function dateTimeAsync(htmlDateTimeInput) {
try {
var opts = { "value" : htmlDateTimeInput.value,
"min" : htmlDateTimeInput.min || "",
"max" : htmlDateTimeInput.max || ""
};
blackberry.ui.dialog.dateTimeAsync("date", opts, window.onDateTimeSelected);
}catch (e) {
alert("Exception in dateTimeAsync: " + e);
}
}
</script>
06-14-2012 07:19 AM
06-14-2012 07:21 AM
06-14-2012 12:54 PM
If the user is clicking an input field (or clicking a button), what about some styling on the input field to make it look like a button?
06-14-2012 01:13 PM
thanks! that's a clever work-around ![]()
my button is on the swipemenu, probably will be harder than that...