RickLiebespach
Programmer
I have two questions that for me are related....
One is how to properly get the radiobutton selected and the other is how to increment a time value.
I have a RadioButton with the values of:
5 minutes
10 minutes
15 minutes
30 minutes
1 hour
I want the user to select a radiobutton and then I'll add that amount of time to the current time and store that in a variable.
What I'm getting is
When the user clicks "5 minutes" (the 1st radio button)
my GetrbSnoozeValue function is returning 60 (what I thought was what I'd get from the 5th radio button)
which my SetSnoozeAlarm function is concatenating to the current date and time returned by Date()
so I get
7/28/2004 11:05:2360
what I want/need is
7/28/2004 11:10:23
assuming the current date and time is 7/28/2004 11:05:23
My code looks like this:
function SetSnoozeAlarm()
{
var myAlarmTime;
var myOffSet;
var myAlarmMessage;
myOffSet = GetrbSnoozeValue();
myAlarmTime = Date() + myOffSet;
myAlarmMessage = GettxtCurrentReminderMessage();
SetMyAlarm(myAlarmTime, myAlarmMessage);
}
function GetrbSnoozeValue()
{
var myOffSetAmount = 0;
var oSnooze = document.getElementById("rbSnooze")
if (oSnooze.selectedIndex = 5) // 1 hour
{
myOffSetAmount = 60;
}
else if (oSnooze.selectedIndex = 4) // 30 minutes
{
myOffSetAmount = 30;
}
else if (oSnooze.selectedIndex = 3) // 15 minutes
{
myOffSetAmount = 15;
}
else if (oSnooze.selectedIndex = 2) // 10 minutes
{
myOffSetAmount = 10;
}
else if (oSnooze.selectedIndex = 1) // 5 minutes
{
myOffSetAmount = 5;
}
else // no radio button selected
{
myOffSetAmount = 0;
}
return myOffSetAmount
}
Rick Liebespach
One is how to properly get the radiobutton selected and the other is how to increment a time value.
I have a RadioButton with the values of:
5 minutes
10 minutes
15 minutes
30 minutes
1 hour
I want the user to select a radiobutton and then I'll add that amount of time to the current time and store that in a variable.
What I'm getting is
When the user clicks "5 minutes" (the 1st radio button)
my GetrbSnoozeValue function is returning 60 (what I thought was what I'd get from the 5th radio button)
which my SetSnoozeAlarm function is concatenating to the current date and time returned by Date()
so I get
7/28/2004 11:05:2360
what I want/need is
7/28/2004 11:10:23
assuming the current date and time is 7/28/2004 11:05:23
My code looks like this:
function SetSnoozeAlarm()
{
var myAlarmTime;
var myOffSet;
var myAlarmMessage;
myOffSet = GetrbSnoozeValue();
myAlarmTime = Date() + myOffSet;
myAlarmMessage = GettxtCurrentReminderMessage();
SetMyAlarm(myAlarmTime, myAlarmMessage);
}
function GetrbSnoozeValue()
{
var myOffSetAmount = 0;
var oSnooze = document.getElementById("rbSnooze")
if (oSnooze.selectedIndex = 5) // 1 hour
{
myOffSetAmount = 60;
}
else if (oSnooze.selectedIndex = 4) // 30 minutes
{
myOffSetAmount = 30;
}
else if (oSnooze.selectedIndex = 3) // 15 minutes
{
myOffSetAmount = 15;
}
else if (oSnooze.selectedIndex = 2) // 10 minutes
{
myOffSetAmount = 10;
}
else if (oSnooze.selectedIndex = 1) // 5 minutes
{
myOffSetAmount = 5;
}
else // no radio button selected
{
myOffSetAmount = 0;
}
return myOffSetAmount
}
Rick Liebespach