I'm trying to pass a variable gathered from a radio button and all day i've been stuck on something that seems so small, maybe i've been staring too long.
No matter what radio that is checked it's resulting as 0.
Here's the button
Code:
<div ID="dCloneTypeSelect" name="dCloneTypeSelect" style="border: 1px solid black; padding: 0px; position: absolute; visibility: hidden;"">
<table bgcolor="#ffffff">
<tr>
<td>
<span style="color:black; font-family:verdana; font-size:8pt; font-weight:normal">
<b>How would you like to clone?</b><br>
<input type=radio id = "rdoClonewHours" name="CloneSelect" value="0" > Clone with Hours <br>
<input type=radio id = "rdoCloneNoHours" name="CloneSelect" value="1" > Clone without Hours <br></span>
<center>
<input type=button value="Clone" style="font-size: 8pt;" onclick="CloneFromTypeSelect()" id=button1 name=button1> <input type=button value="Cancel" style="font-size: 8pt;" onclick="HideCloneTypeSelect('btnClone')" id=button2 name=button2><br>
</center>
</td>
</tr>
</table>
</div>
Then where i'm trying to get and set selected.
Code:
function GetCloneType()
{
var CloneType = 0;
if (document.getElementById("rdoClonewHours").checked)
CloneType = 0;
else if (document.getElementById("rdoCloneNoHours").checked)
CloneType = 1;
//alert (CloneType);
return CloneType;
}
Then where i am trying to use the type. Which works if i can get 0 or 1, it's the function above that needs work.
Code:
function CloneTS()
{
var CloneSelect = GetCloneType()
if (CloneSelect == 0)
{
var confirm_clonewhours = confirm ("You are cloning codes and hours from last pay period, not including any leave hours, do you wish to continue?");
if (confirm_clonewhours == false)
{
document.getElementById("dCloneTypeSelect").style.visibility = 'visible';
document.getElementById("rdoClonewHours").checked = true;
}
}
else if (CloneSelect == 1)
{
var confirm_clonenohours = confirm ("You are cloning codes only from last pay period, not including any leave codes, do you wish to continue?");
if (confirm_clonenohours == false)
{
document.getElementById("dCloneTypeSelect").style.visibility = 'visible';
document.getElementById("rdoCloneNoHours").checked = true;
}
}
}
No matter what i modify i keep getting 0, suggestions?!
alert returns undefined, if i define as 0 again, same thing...keeps setting to 0
...i'm open to changes, i myself was trying to modify an already existing app in which this is working elsewhere but the code is so mixed everywhere it's hard to insert new stuff
[RESOLVED] Stuck on radio.checked, should be simple
Ugh i figured this out, told you it was stupid, i moved the call to HideCloneTypeSelect to the end of the CloneTS function, everytime i was hiding i was resetting the checkboxes to false hence always returning 0.
Last edited by ckline039; 08-15-2012 at 02:42 PM.
Reason: Resolved
Ugh i figured this out, told you it was stupid, i moved the call to HideCloneTypeSelect to the end of the CloneTS function, everytime i was hiding i was resetting the checkboxes to false hence always returning 0.
Well, that helps explain why we needed to see the rest of the code.
Bookmarks