DatePicker control WP7 - windows-phone-7

I am using the DatePicker control from WP7 control toolkit in my app for the user to enter in an expiration date. One of the scenarios is that the record doesn't have an expiration date. How can I use the control such that by default, there is no date specified in the control and the user can select a different date?
Also, if I user sets an expiration date but letter wants to clear it, I need to enable that as well.
Pratik

For the default value to be blank, in the XAML
<toolkit:DatePicker x:Name="dpComp" Value="" Width="220" Hold="dpComp_Hold"/>
If you would like to allow a user to clear the value of datepicker then you can do this in the code
private void dpComp_Hold(object sender, System.Windows.Input.GestureEventArgs e)
{
//Let user to clear the value.
((DatePicker)sender).Value = null;

The DatePicker control doesn't support the concept of no date selected.
The DatePicker will default to the current date if none is selected on the assumption that this will be the most useful to the user. Forcing the user to select values which you could provide a likely default value for means you're making the user do more work than they should have to and you are therefore wasting their time.
If no expiry date is valid, leave this field blank by default.
With regard to clearing an entered date, add a separate option to do this. Either a button or menu option.

I would look at the .api for customization of the DatePicker Control: http://windowsphonegeek.com/articles/wp7-datepicker-and-timepicker-in-depth--api-and-customization
I don't know of anyway to do what you are looking for (however I might want to know in the future). The link above seems to suggest you can create your own custom page and you can then maybe work out a way to return what you are looking for.

Related

Windows Phone Date Picker Submit event

I have a native Date Picker in a windows phone app.
Using the DateChanged event I can perform actions when the user submits.
DatePicker.DateChanged += (o, args) =>
{
var date = args.NewDate;
// Do something with it
}
The problem I am facing is the event is not triggered if the user submits the date picker without changing the date.
Default value is set to today's date which makes it impossible to select this date.
Does anyone know how I can allow the user the select this date and perform actions after ?
Thanks for your help :)
There is no particular way of getting an event fired when the date is not changed. As you said the date picker by default selects the current date, you can perform the action you want to if the user selects today's date in the OnNavigatedTo, Loaded, or DatePicker_Loaded event. A better way to do so is providing the DatePicker an invalid date something like 1Jan1947, this ways the user has to change the date else it'll be invalid. Also if you write the code you want on dateChanged event, it'll fire automatically as when the DatePicker is Loaded it sets the date from default to the current date.
What I would recommend
is to use a binding property to hold a value and then performing the
operations onPropertyChanged event of that property. This ways your
logic is independent of your datePicker and you could write events
for each time the dateTime property changes.
Do remember to bind the datePicker's date property to the DateTime
property in a TwoWay Mode and an UpdateSourceTrigger of
PropertyChanged. This ways when you change the property from code
behind the data would reflect in the datePicker and when you change
the value in the datePicker, the data would be reflected in the code
behind as well

OBIEE prompt set: Disable user input in date field

I have a report which contains date prompts. For several reasons, we want to disable manual user input into these date prompts, and to require the use of the date picker instead (this requirement won't change).
How can one do this?
What I've tried:
adding a javascript snippet (embedded in an invisible text prompt) to disable the text field. This works, however when I click "Apply" in the promptset, the date field is re-enabled!
Any insight on how I can accomplish this?
Anybody know how to hack the behavior of the Apply button so I can call my js function again? OR where can I hack the raw html of the promptset/report so that can set the date fields to "disabled=true"?
I do not know of any hack for the "Apply" button, however if we change your process a bit, instead of locking the columns down (and possibly creating confusion for the end user "Why can't I click on this prompt!!"), what we could do is hide the prompts either by using a JQuery function, or other method. The link within this answer describes several options to hide prompts:
Hidden prompts (Oracle Method)
Hiding prompts using guided navigation
Hiding prompts in a section
Hiding certain UI controls inside a prompt
This link has many other links to resources, and should hopefully answer your question, albeit in a different way.
Links (several in case one gets broken):
http://intelligentinsight.wordpress.com/2012/10/20/obiee-11g-hidden-prompts-and-hiding-prompts/ (Main Link)
http://docs.oracle.com/cd/E21764_01/bi.1111/e10544/prompts.htm#CIHCDDEG (Oracle Link, should be stable)
http://intelligentinsight.wordpress.com/2012/09/23/obiee-11g-improve-dashboard-prompt-ui-selectively-hiding-and-displaying-prompts-using-jquery/ (Link with JQuery instruction)

Get value from autocomplete text field in ApEx

I want to create a dynamic action, that will set a value to an item on the page, when the value of another item (autocomplete text field) is set.
So the proccess goes like this:
Click on the autocomplete field
type some letters
choose one of the suggested values
I cannot find an event that will be executed when the selection of one of the suggested values happens. This way, I cannot see how I can read the value of the autocomplete field, once a suggested value is selected.
The change event doesn't fit my needs, it doesn't execute when one suggested value is selected.
I had the same problem, found this link: https://community.oracle.com/thread/2130716?tstart=0 and modified my dynamic action as follows to get the desired behaviour:
Event = Custom
Custom Event = result
From the link:
the problem seems to be the default behavior of the browser. When you
enter some text into the autocomplete and the list is displayed, the
focus is still in the text field. Also if you use the keyboard cursors
to pick an entry the focus will still be in the textfield. That's why
the change event of the textfield doesn't fire. It only fires if you
leave the field.
On the other side if you pick an entry with the mouse, the browser
will remove the focus from the text field for a moment (before the
JavaScript code puts the focus back), because you clicked outside of
the field. But that's enough so that the browser fires the change
event.
I had a look into documentation of the underlaying jQuery Autocomplete
widget
(http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/) and
there is actually an event called "result" which can be captures if an
entry is selected from the drop down list.
Try "Lose Focus" as event. It will trigger your dynamic action when you leave the autocomplete field, i.e. your curosr is moved to another field.
This probably depends on the APEX version you are using.
In case of 18.2, because the underlying component is based on Oracle JET's "inputSearch" component, you need to use following configure to capture the select change event for text with autocomplete:
event: Custom
custom event: ojupdate
Reference:
https://docs.oracle.com/cd/E87657_01/jet/reference-jet/oj.ojInputSearch.html#event:optionChange
I turned on the browser console, then turned ApEx Developer toolbar debug, and found that, on the contrary, the "Change" event does fire upon user clicking with the mouse on one of the selections. However if the user uses keyboard (type a few letters to narrow the list down, then use down arrow key to arrive at desired value, then press enter) then the Change event does not fire, just as you say.
Moreover: even when you do get the value sent back via mouse-click initiated Change event, the value isn't the autocomplete's complete and valid value, but instead the possibly partial and wrong-case value just as typed by the user. I.e., the the change event's submission of the value precedes the autocomplete's substitution.
The answer that #VincentDeelen gave is the best alternative that I can see, although it doesn't quite give that "instantantenous synchronicity" feel. You could maybe use the "Key Down" event, but be careful with that. You could get a really excessive amount of web and db traffic as each and every keystroke (including corrections) results in another firing of the dynamic action.
Testing environment: ApEx 4.2.3 with Chrome 33 as well as IE 9.
p.s. This might be worth a mention to the ApEx development team as well.
It's not really ideal, but you could use onfocus(). I'm looking for the same thing you are, I think, a custom event that fires when the selection of a suggested value happens. I haven't found it yet though and that is my work-around for now. It will run whatever function you've created for this initially with no value, but once the selection is made it will return focus and run the function again with the right value. Like I said, not ideal but it works.
Jeffrey Kemp is right. You can set it up through a dynamic action using the custom event, result. You can also register it on page load using document.getElementById("{id}").addEventListener("result", {function}); or $("#{id}").result( function( event, data, formatted ) { //something here });.
Oracle apex 19 now added a "component event" when you create a dynamic action called "Update [Text Field with autocomplete]" - this action is fired when you select a value from the list, but not when you leave the field (similar to adding the custom event "ojupdate").

KendoUI DateTimePicker (or similar) - make textbox un-editable but allow changing of date/time via provided buttons

I have a form which is using DateTimePicker on one of the inputs. I would like the user to be able to select the date/time by using the buttons which KendoUI attaches to the right of the input field, however I don't want the user to free-type into the text field (to save me having to verify formatting or rubbish input).
It is possible to add readonly attribute to the input, either in HTML or by calling .readonly() method on the DateTimePicker object. This makes the text field un-editable, however it also prevents the click events on the date/time selectors from firing.
So, how do I prevent the user from being able to edit the textbox field manually?
Thanks in advance.
Yes, you can set the readonly attribute only of the input from which the datepicker was created:
<input id="datepicker">
<script>
$("#datepicker").kendoDatePicker().attr("readonly", true);
</script>
Here is a live demo: http://jsbin.com/uwayit/1/edit

how to assign selected value to RecurringDaysPicker for WP7

I am using RecurringDaysPicker from toolkit for WP to select the day of the week for an application.
I have no issue to obtain the selection from the user, but I do have issue assigning back the user selection back to the RecurringDaysPicker when user want to edit/view their previous selection.
anybody can help?
Thanks
You should probably set your binding Mode to Mode=TwoWay

Resources