зеркало из https://github.com/mozilla/pjs.git
adding some integer validation code to the textboxes and adding code to delete properties from the event object if they are empty in the dialog
This commit is contained in:
Родитель
40a0da5960
Коммит
93945ee5b8
|
@ -79,3 +79,13 @@ function disableElement(elementId)
|
|||
{
|
||||
setElementValue(elementId, "true", "disabled");
|
||||
}
|
||||
|
||||
/* use with textfields oninput to only allow integers */
|
||||
function validateIntegers(event)
|
||||
{
|
||||
if (isNaN(Number(event.target.value))) {
|
||||
var newValue = parseInt(event.target.value);
|
||||
event.target.value = isNaN(newValue) ? "" : newValue;
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -233,6 +233,7 @@ function saveDialog(event)
|
|||
event.alarmTime = alarmTime;
|
||||
}
|
||||
|
||||
dump(event.icalString + "\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -319,6 +320,8 @@ function editRecurrence()
|
|||
/* utility functions */
|
||||
function setEventProperty(event, propertyName, value)
|
||||
{
|
||||
if (value)
|
||||
if (!value || value == "")
|
||||
event.deleteProperty(propertyName);
|
||||
else
|
||||
event.setProperty(propertyName, value);
|
||||
}
|
||||
|
|
|
@ -116,15 +116,6 @@
|
|||
</hbox>
|
||||
</row>
|
||||
|
||||
<row align="center" hidden="true">
|
||||
<label value="Attendees" class="label"/>
|
||||
<hbox align="center">
|
||||
<label value="none"/>
|
||||
<spacer flex="1"/>
|
||||
<button disabled="true" label="set..."/>
|
||||
</hbox>
|
||||
</row>
|
||||
|
||||
<row align="center">
|
||||
<label value="Calendar" class="label"/>
|
||||
<hbox>
|
||||
|
@ -153,7 +144,7 @@
|
|||
<row align="center">
|
||||
<spacer/>
|
||||
<hbox align="center" id="alarm-details">
|
||||
<textbox id="alarm-length-field" size="1"/>
|
||||
<textbox id="alarm-length-field" size="1" oninput="validateIntegers(event);"/>
|
||||
<menulist id="alarm-length-units">
|
||||
<menupopup>
|
||||
<menuitem label="minutes" value="minutes" selected="true"/>
|
||||
|
@ -172,7 +163,7 @@
|
|||
|
||||
</rows>
|
||||
|
||||
<textbox id="event-description" multiline="true" rows="2"/>
|
||||
<textbox id="event-description" multiline="true" rows="4"/>
|
||||
|
||||
</rows>
|
||||
</grid>
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
<!-- Daily -->
|
||||
<hbox align="top">
|
||||
<label value="Every"/>
|
||||
<textbox id="daily-days" size="3"/>
|
||||
<textbox id="daily-days" size="3" oninput="validateIntegers(event);"/>
|
||||
<label value="days"/>
|
||||
<spacer flex="1"/>
|
||||
</hbox>
|
||||
|
@ -127,7 +127,7 @@
|
|||
|
||||
<hbox align="top">
|
||||
<label value="Every"/>
|
||||
<textbox id="yearly-years" size="3"/>
|
||||
<textbox id="yearly-years" size="3" oninput="validateIntegers(event);"/>
|
||||
<label value="years"/>
|
||||
<spacer flex="1"/>
|
||||
</hbox>
|
||||
|
@ -156,7 +156,7 @@
|
|||
<row>
|
||||
<radio label="Repeat for" value="ntimes"/>
|
||||
<hbox>
|
||||
<textbox id="repeat-ntimes-count" size="3"/>
|
||||
<textbox id="repeat-ntimes-count" size="3" oninput="validateIntegers(event);"/>
|
||||
<spacer flex="0.5"/>
|
||||
<menulist id="repeat-ntimes-units">
|
||||
<menupopup>
|
||||
|
|
Загрузка…
Ссылка в новой задаче