String Value

1. Senior Member
Join Date
Dec 1969
Posts
1,045

String Value

I want to determine if the string value is &#062;=19 AND &#060;=26 or == 12 or == 1<BR><BR>How do modify and add this logic to what I already have?<BR>if (str &#062;= "19")<BR>

2. Senior Member
Join Date
Dec 1969
Posts
2,892

RE: String Value

if ( (parseInt(str) &#062;=19 && parseInt(str) &#060;=26) &#124&#124 parseInt(str) == 12 &#124&#124 parseInt(str) == 1 )<BR>{<BR> blah blaf<BR>}<BR><BR>Try that

3. Senior Member
Join Date
Dec 1969
Posts
286

RE: String Value

have you tried<BR>if ((str &#062;= "19" && str &#060;= "26") &#124&#124 str == "12" &#124&#124 str == "1")<BR><BR>you might want to parse them to get int values when you compare...<BR>I think "2" will evaluate to true in that statement. (but I&#039;m not sure) string logic always trips me up.<BR><BR>try <BR>num = parseInt(str);<BR>if((num&#062;=19 && num&#060;=26) &#124&#124 num==12 &#124&#124 num==1)<BR><BR>If that doesn&#039;t work, I&#039;m a terrible person (I mean programmer).<BR><BR>Take it easy!<BR>Trey<BR><BR>

4. Senior Member
Join Date
Dec 1969
Posts
1,045

RE: String Value

Both work thanks guys

5. Senior Member
Join Date
Dec 1969
Posts
1,045

Having problems with the following::

Here is the script that is not perfroming like I thought it would:<BR><BR>// Determine if certain Calendar Categories have been selected. If the string returned = whats listed below then allow other two dropdows to be seen else hide them<BR>function checkMDSiteVisit(str){ <BR> // Uncomment if there are categories that we need to specify outside of &#062;=18 and &#060;=23<BR> //if ( (parseInt(str) &#062;=19 && parseInt(str) &#060;=26) &#124&#124 parseInt(str) == 12 &#124&#124 parseInt(str) == 1 ) <BR> if ( (parseInt(str) &#062;=18 && parseInt(str) &#060;=23) ) <BR> { <BR> toggle(&#039;practice&#039;);<BR> alert("You must also select who will be attending this meeting and also the practice that will be visited, from the form options now displayed below.");<BR> document.AddCalendar.location.disabled = true;<BR> }<BR> else<BR> {<BR> target = document.all( &#039;practice&#039; );<BR> target.style.display = "none";<BR> document.AddCalendar.location.disabled = false;<BR> }<BR>} <BR><BR>&#060;SELECT name="CategoryID" class="forminput" onChange="checkMDSiteVisit(this.options[this.selectedIndex].value);"&#062;&#060;option value=&#039;&#039;&#062;&#060;/option&#062;&#060;OPTION Value=&#039;11&#039;&#062;All Staff Meeting<BR>&#060;OPTION Value=&#039;14&#039;&#062;Community Events<BR>&#060;OPTION Value=&#039;1&#039;&#062;Credentialing<BR>&#060;OP TION Value=&#039;5&#039;&#062;Finance<BR>&#060;OPTION Value=&#039;13&#039;&#062;GRIPA Annual Picnic<BR>&#060;OPTION Value=&#039;2&#039;&#062;GRIPA Board of Directors<BR>&#060;OPTION Value=&#039;17&#039;&#062;GRIPA Projects<BR>&#060;OPTION Value=&#039;12&#039;&#062;Holiday Events<BR>&#060;OPTION Value=&#039;16&#039;&#062;IT<BR>&#060;OPTION Value=&#039;19&#039;&#062;MD Site Visit CMS<BR>&#060;OPTION Value=&#039;22&#039;&#062;MD Site Visit IT<BR>&#060;OPTION Value=&#039;23&#039;&#062;MD Site Visit Med Director<BR>&#060;OPTION Value=&#039;21&#039;&#062;MD Site Visit Network<BR>&#060;OPTION Value=&#039;18&#039;&#062;MD Site Visit Other<BR>&#060;OPTION Value=&#039;20&#039;&#062;MD Site Visit Pharmacy<BR>&#060;OPTION Value=&#039;4&#039;&#062;Medical Management<BR>&#060;OPTION Value=&#039;7&#039;&#062;PCP Breakfast<BR>&#060;OPTION Value=&#039;29&#039;&#062;PMAG<BR>&#060;OPTION Value=&#039;6&#039;&#062;Quality Management<BR>&#060;OPTION Value=&#039;15&#039;&#062;Recreation<BR>&#060;OPTI ON Value=&#039;10&#039;&#062;RGPO Board of Directors<BR>&#060;OPTION Value=&#039;8&#039;&#062;RGPO HARP Meetings<BR>&#060;OPTION Value=&#039;3&#039;&#062;Utilization Management (UM)<BR>&#060;OPTION Value=&#039;9&#039;&#062;VOW HARP Meetings<BR>&#060;/SELECT&#062;<BR><BR><BR>&#060;div id="practice" style="display: none;"&#062; <BR><BR>&#060;select name="select2" size="1" class="forminput"&#062;<BR> &#060;option value="value 1"&#062;label one&#060;/option&#062;<BR> &#060;/select&#062;<BR><BR>&#060;/div&#062;<BR><BR>After selecting the options from the first dropdown that are listed in my Jscript I should now see the second dropdown. What I am noticing is that the 2nd dropdown is alternating between being visible and not visible based on selecting only those that have been indicated in jscript<BR>

6. Senior Member
Join Date
Dec 1969
Posts
286

RE: Having problems with the following::

What does the toggle(&#039;practice&#039;) function do?<BR>

7. Senior Member
Join Date
Dec 1969
Posts
1,045

Toggle is a function..

..that determines if the Display is &#039;none&#039; or &#039;inline&#039; Practice is the id within the the Div Tag. The second function in this case is calling upon the first function.

8. Senior Member
Join Date
Dec 1969
Posts
286

RE: Toggle is a function..

So, did I understand the question right?<BR><BR>I thought you said something like "when I choose options within the range that I want to show the hidden div for (18-26?), it alternates between showing and not showing the div"<BR><BR>So if you got rid of "toggle(&#039;practice&#039;);" and replaced it with<BR><BR>document.getElementById(&#039;practice &#039;).style.display=&#039;block&#039;; <BR><BR>Would that fix your problem?

9. Senior Member
Join Date
Dec 1969
Posts
1,045

Kinda..

I think. I just changed it to this and it works:<BR><BR>Instead of calling the first function within the second I simply plopped the two functions together and hopefully made it better. Again this works <BR><BR>function checkMDSiteVisit(str){ <BR> // Uncomment if there are categories that we need to specify outside of &#062;=18 and &#060;=23<BR> //if ( (parseInt(str) &#062;=19 && parseInt(str) &#060;=26) &#124&#124 parseInt(str) == 12 &#124&#124 parseInt(str) == 1 ) <BR> if ( (parseInt(str) &#062;=18 && parseInt(str) &#060;=23) ) <BR> { <BR> target = document.all( &#039;practice&#039; );<BR> target.style.display = "inline";<BR> alert("You must also select who will be attending this meeting and also the practice that will be visited, from the form options now displayed below.");<BR> document.AddCalendar.location.disabled = true;<BR> }<BR> else<BR> {<BR> target = document.all( &#039;practice&#039; );<BR> target.style.display = "none";<BR> document.AddCalendar.location.disabled = false;<BR> }<BR>}

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•