Skip to content

Commit

Permalink
add binding to force usage of date picker
Browse files Browse the repository at this point in the history
  • Loading branch information
darkv committed Jun 29, 2016
1 parent a112d84 commit 6bc5a92
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Frameworks/Ajax/Ajax/Components/AjaxDatePicker.api
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<binding name="startDay"/>
<binding defaults="Boolean" name="showYearControls"/>
<binding name="otherTagString"/>
<binding name="readonly"/>
<binding defaults="Boolean" name="readonly"/>
<binding defaults="Boolean" name="manualInput"/>
</wo>
</wodefinitions>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DateInput : WOTextField {
maxlength = ^maxlength;
name = ^name;
disabled = ^disabled;
readonly = ^readonly;
readonly = inputFieldIsReadonly;
onfocus = onFocusScript;
onclick = onClickScript;
otherTagString = ^otherTagString;
Expand Down
5 changes: 5 additions & 0 deletions Frameworks/Ajax/Ajax/Sources/er/ajax/AjaxDatePicker.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
* @binding disabled passed to the input field
* @binding onDateSelect JavaScript to execute when a date is selected from the calendar
* @binding fireEvent false if the onChange event for the input should NOT be fired when a date is selected in the calendar, defaults to true
* @binding manualInput false if you want to prevent manual input from the user and force him/her to use the date picker, defaults to true
*
* @binding startDay specify the first day of week to use 0(Sunday)-6(Saturday). The default use the current localizer.
* @binding dayNames list of day names (Sunday to Saturday) for localization, English is the default
Expand Down Expand Up @@ -194,6 +195,10 @@ public NSArray<String> monthNames() {
return localizeStringArray(_monthNames);
}

public boolean inputFieldIsReadonly() {
return booleanValueForBinding("readonly", false) || !booleanValueForBinding("manualInput", true);
}

/**
* Sets up AjaxOptions prior to rendering.
*
Expand Down

0 comments on commit 6bc5a92

Please sign in to comment.