/    Sign up×
Community /Pin to ProfileBookmark

Help! Should be easy for you guru’s!

OK, I designed a javascript process form..

Basically it has a bunch of questions with mostly Yes and No bullets..

The form is made up by a whole bunch of Show/Hide Features.

My question is, right now you can select both yes and no on any question.. How do make it so I can only select either yes or no? Below is a snippet of the many show hides I have in the page.

[CODE]<!——————————-Problem SPECIFIC TEMPLATE—————————->
<DIV class=secTitle subSec=”ProblemSec”>PROBLEM CASE</DIV>
<DIV subSec=”ProblemSec”><SPAN class=sLabel name=”iLabel” subSec=”ProblemSec”>IS
THE PROBLEM CASE OPEN?:</SPAN> <SPAN subSec=”ProblemSec”> <strong>Yes</strong>
<INPUT id=addlAreacheck13 onclick=”tf_change(this); simpleSHcheck0(this)”
type=checkbox value=No sToggle=”IsSubCaseDispatched”> <strong>No </strong> <SPAN>
<INPUT id=addlAreacheck14 onclick=”tf_change(this); simpleSHcheck0(this)”
type=checkbox value=No sToggle=”nowhere”></SPAN> &nbsp;</SPAN></DIV>
[/CODE]

Thanks for your help!!

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@scragarFeb 24.2009 — It's not a javascript issue, it's HTML.

change the type to radio, and give it a name.
Copy linkTweet thisAlerts:
@PPloesserauthorFeb 24.2009 — Ok, If I change the type to radios and from checkboxes.. How does it know only 1 can be selected in each show hide?
Copy linkTweet thisAlerts:
@MaydayFeb 24.2009 — The nature of radio buttons is to only allow one to be selected.

http://www.htmlgoodies.com/tutorials/forms/article.php/3479121#radio

Checkboxes allow more than one to be selected.

http://www.htmlgoodies.com/tutorials/forms/article.php/3479121#check
Copy linkTweet thisAlerts:
@PPloesserauthorFeb 24.2009 — I changed them to radios and if I choose yes and no, both options will still drop down.. What's weird is when I changed the type to radio I cannot actually tell which one is selected. It doesn't fill in
Copy linkTweet thisAlerts:
@PPloesserauthorFeb 25.2009 — Anyone else have any input on this? Here is some code from the show/hide function

[CODE]<!---------------MULTIPLE SIMPLE SHOWHIDE CHECK FUNCTION------------------->
function simpleSHcheck0(objID)
{
if (objID.type="radio")
{
var ss = objID.sToggle
for (var f = 0; f < formList.length; f++)
{
if ((formList[f].subSec == ss) && (formList[f].style.display != "none")) {formList[f].style.display = "none";}
else if ((formList[f].subSec == ss) && (formList[f].style.display != "inline")) {formList[f].style.display = "inline";}
}
for (var g = 0; g < divList.length; g++)
{
if ((divList[g].subSec == ss) && (divList[g].style.display != "none")) {divList[g].style.display = "none";}
else if ((divList[g].subSec == ss) && (divList[g].style.display != "block")) {divList[g].style.display = "block";}
}
for (var h = 0; h < spanList.length; h++)
{
if ((spanList[h].subSec == ss) && (spanList[h].style.display != "none")) {spanList[h].style.display = "none";}
else if ((spanList[h].subSec == ss) && (spanList[h].style.display != "inline")) {spanList[h].style.display = "inline";}
}
}
}
<!-------------------------MAIN SHOWHIDE FUNCTION-------------------------->
function showHide(hdVar, shVar)
{
if (hdVar == "everything") {var shArray = new Array("ThirdUpdate6","SecondUpdate5","BeyondThirdUpdate5","FirstUpdate6","ReqCaseInvalidSepMgmt1","BeyondThirdUpdate4","FirstUpdate5","SecondUpdate4","ThirdUpdate5","ClientIsSatisfied7","NotInOLA4","OLAYes4","ClientIsSatisfied6","SecondUpdate3","FirstUpdate4","ThirdUpdate4","InOLA5","BeyondThirdUpdate3","ThirdUpdate3","OLAYes3","NotInOLA3","UpdateCase1","InOLA4","StatusAvail1","BeyondThirdUpdate2","SecondUpdate2","ClientIsSatisfied5","SecondUpdate1","FirstUpdate3","NotInOLA2","OLAYes2","InOLA3","FirstUpdate2","OLAYes1","SRFeCase2","SRFeCase","SRFAttatched","IsTheSubAccepted","addlForm","AccountReqProc","InOLA","ClientIsSatisfied4","ERLcase","NotInOLA","FirstUpdate","BeyondThirdUpdate","SecondUpdate","ThirdUpdate2","ThirdUpdate","ClientIsSatisfied2","ClientIsSatisfied3","ClientIsSatisfied","StatusAvail","OLAYes","CreatCCTCase","UpdateCase","IsSubCaseDispatched2","IsSubCaseDispatched","ReqCaseInvalidSepTrue","NoCaseExistsProb","NoCaseExistsReq","ReqCaseOpenYes","ReqCaseInvalidSepClient","ReqCaseInvalidSepMgmt","ReqCaseInvalidSep","ReopenMainCase","bbForm","CreateMainCase","ProblemSec", "CaseExistYes", "CaseExistNo", "ReqClosedProc", "ReqCaseExistYes", "prophSec2","prophSec"); var runHide = true;}
if (hdVar == "prophSecCombo") {var shArray = new Array("prophSec2","prophSec"); var runHide = true;}
if (runHide == true)
{
for (var x = 0; x < shArray.length; x++)
{
for (var z = 0; z < formList.length; z++)
{
if (formList[z].subSec == shArray[x]) {formList[z].style.display = "none";}
}
for (var t = 0; t < spanList.length; t++)
{
if (spanList[t].subSec == shArray[x]) {spanList[t].style.display = "none";}
}
for (var q = 0; q < divList.length; q++)
{
if (divList[q].subSec == shArray[x]) {divList[q].style.display = "none";}
}
}
}
if (hdVar != "everything")
{
for (var y = 0; y < formList.length; y++)
{
if ((formList[y].subSec == shVar) && (formList[y].style.display != "inline")) {formList[y].style.display = "inline";}
}
for (var y = 0; y < divList.length; y++)
{
if ((divList[y].subSec == shVar) && (divList[y].style.display != "block")) {divList[y].style.display = "block";}
}
for (var y = 0; y < spanList.length; y++)
{
if ((spanList[y].subSec == shVar) && (spanList[y].style.display != "inline")) {spanList[y].style.display = "inline";}
}
}
}
[/CODE]
Copy linkTweet thisAlerts:
@PPloesserauthorFeb 25.2009 — Ok, I decided to go a different route..

Basically I have a Yes/No question when someone choose yes or no a showHide will show a hidden section, When I switched to radio it is still not working..

Anyone see a flaw in my code? [CODE]<input type="radio" id="CaseExistYes" name="CaseExistYes" value="CaseExistYes" onclick="changeRadVAR(this.id, this.value); showHide('CaseExistYes)'">[/CODE]

It's not showing CaseExistYes section when the radio is selected.
Copy linkTweet thisAlerts:
@MaydayFeb 25.2009 — Ok, I decided to go a different route..

Basically I have a Yes/No question when someone choose yes or no a showHide will show a hidden section, When I switched to radio it is still not working..

Anyone see a flaw in my code? [CODE]<input type="radio" id="CaseExistYes" name="CaseExistYes" value="CaseExistYes" onclick="changeRadVAR(this.id, this.value); showHide[COLOR="Red"]('CaseExistYes)'[/COLOR]">[/CODE]

It's not showing CaseExistYes section when the radio is selected.[/QUOTE]



You appear to have typed your ()'s and ' ' 's out of order. Not sure if that's the only thing wrong, but it's certainly a start.
×

Success!

Help @PPloesser spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...