Page 2 of 3

Re: Date Widget

Posted: Mon Nov 25, 2013 11:53 am
by Paul_Ramcharitar
Hi scott, how do I go about preventing the default action?

Re: Date Widget

Posted: Mon Nov 25, 2013 5:38 pm
by Scott Klement
We provide an API for this:
http://www.profoundlogic.com/docs/displ ... +event+%29

However, you need to pass the event object to it. In the newest release, we've created a global variable for the event object, but in previous releases it wasn't always available.

Re: Date Widget

Posted: Tue Dec 03, 2013 11:10 am
by Paul_Ramcharitar
preventEvent didn't work (in the mobile client). I put it in the onlick on the widget, like so:

Code: Select all

setTimeout( function() { pui.showCalendar("Date1"); }, 0 );
preventEvent(event);

Re: Date Widget

Posted: Wed Dec 04, 2013 10:20 am
by David
What version of Profound UI are you using?

Also, when you say it doesn't work, do you mean to say that the default event action is just not prevented, or is some error reported?

Re: Date Widget

Posted: Thu Dec 05, 2013 1:49 pm
by Paul_Ramcharitar
version : 4.7.1

I have this set in the onclick of an image widget:

Code: Select all

pui.showCalendar("Date1");
preventEvent(event);
It works in the browser (the calender pops up), so I assume the default action is prevented, but it does not work in the profound ui mobile client. When I tap on the image nothing happens.

Re: Date Widget

Posted: Thu Dec 05, 2013 2:00 pm
by David
Thanks. If you have 4.7.1, it should work, as the 'event' variable was only added to the widget event properties in that release.

It must be some issue with running it in the mobile client. Can you please contact our technical support team and:

1. Send a copy of your display source code. You can use File->Save As and then the Local tab to save it to your PC.

2. Let us know what specific device and OS version you are running the mobile client on.

We can then test with the screen here to see if we can reproduce and correct the problem.

Re: Date Widget

Posted: Thu Dec 05, 2013 2:41 pm
by Paul_Ramcharitar
Thanks David. I sent a email with the details and source code.

Re: Date Widget

Posted: Thu Dec 05, 2013 5:03 pm
by David
Thanks, we'll have a look. In the meanwhile, an alternative might be to use the device's built-in date picker. To do that, you could just use a normal textbox and set 'input type' to 'date'. This will bring up the device's built-in date picker anytime the user puts the cursor into the text box.

If you wanted to still have a separate image they can tap on to show it, you could just focus in the box with this code when clicking on the image.

Code: Select all


getObj("Date1").focus();

Of course, we will try to determine what is going wrong with the PUI date picker in this case, but this might get you going in the meanwhile.

The device's built-in picker might also be a bit more 'finger friendly'. Maybe that was the motivation for them to tap on a separate image to begin with?

Re: Date Widget

Posted: Mon Dec 09, 2013 9:10 am
by Paul_Ramcharitar
Hi thanks. Yes my problem was the pui datepicker not being finger friendly in mobile devices. The built in date picker is a great solution. But can I change the format the date is returned in? Right now it returns this format: "mm/dd/yyyy". I would like it in this format: "yyyy-mm-dd"

Re: Date Widget

Posted: Mon Dec 09, 2013 10:36 am
by David
What type of field are you binding to the 'value' of the text box? If you use a date field, it will simply be returned as a date value. I'm guessing that you are not using a date field, if the format is coming into play? If you need to store dates in a different type of field, you could date fields in the display file, and then use %Char() in your RPG program to convert them to character, and then %Dec() to convert to numeric, if you are storing it that way.

Does that help?