JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 2nd, 2004, 03:23 PM
campbecm campbecm is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 3 campbecm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Use a Javascript Function with multiple variables

I'm in the process of developing a remote order entry system for our medical laboratory and need help with one javascript function.

Screenshot is here of the page I'm working with:
http://www.rml-lab.com/ss.gif

I have a listing of the Physician's top ordered tests, and their Organization's top ordered tests, but now need a "Grouping of tests" so a single click can order multiple tests. So when maybe a new patient comes in they can click on a "grouped test" called "new patient admit" and would order the following tests for example cbc, bmp, mdg, etc..

Here is my code so far:

Code:
function setCode(theBox){
  elem = document.entry.elements;
  for(i=0;i<elem.length;i++){
	if(elem[i].name.match(/test\d+/)){
	  if(theBox.value==elem[i].value){
		if(theBox.checked==false){
		  elem[i].value = "";
		  closeGap(elem[i]);
			document.entry.search.value="";
			document.entry.search.focus();
		}
		return false;
	  }
	  if(elem[i].value==""){
		elem[i].value=theBox.value;
		  document.entry.search.value="";
		  document.entry.search.focus();
		return false;
	  }
	}
  }
  return false;
}

function removeCode(theBox){
  elem = document.entry.elements;
  for(i=0;i<elem.length;i++){
	if(elem[i].name.match(/test\d+/)){
	  if(theBox.value==elem[i].value){
		  elem[i].value = "";
		  closeGap(elem[i]);
			document.entry.search.value="";
			document.entry.search.focus();
		return false;
	  }
	  if(elem[i].value==""){
		elem[i].value=theBox.value;
		return false;
	  }
	}
  }
  return false;
}

function closeGap(theField){
  theForm = theField.form;
  fPref = theField.name.replace(/\d/g,"");
  fNum = theField.name.replace(/\D/g,"")*1;
  for(var i=fNum;theForm[fPref+(i+1)];i++){
	theForm[fPref+i].value = theForm[fPref+(i+1)].value;
  }
}




Each row of data looks like so:

Code:
		<td bgcolor="ffffff" align="center"><img src="../images/select.gif" border="0" value="DRAWING FEE" onClick="setCode(this)"></td> 	  
		<td bgcolor="ffffff"><a href="info.cfm?id=489" class="link1" target="_blank">DRAWING FEE</a></td> 	  
	 
		<td bgcolor="ffffff" align="center"><img src="../images/select.gif" border="0" value="TSH (THYROID STIM. HORMONE)" onClick="setCode(this)"></td> 	  
		<td bgcolor="ffffff"><a href="info.cfm?id=349" class="link1" target="_blank">TSH (THYROID STIM. HORMONE)</a></td> 	  
	 
		<td bgcolor="ffffff" align="center"><img src="../images/select.gif" border="0" value="LIPID PANEL" onClick="setCode(this)"></td> 	  
		<td bgcolor="ffffff"><a href="info.cfm?id=202" class="link1" target="_blank">LIPID PANEL</a></td> 



How can make it so if there are multiple tests defined to each row that when the user clicks on the checkmark I can run the say 10 tests though the above function and fill in the test boxes shown in the screenshot?

Sample row of data for a "grouped test" would look like:

Code:
<td bgcolor="ffffff" align="center"><img src="../images/select.gif" border="0" value="CBC|BMP|MDG|Urine Culture" onClick="setCode(this)"></td> 	  
		<td bgcolor="ffffff"><a href="profile.cfm?id=CBC|BMP|MDG|Urine Profile" class="link1" target="_blank">Sample Admit Profile</a></td>


I would also have to use the | character to break up the tests, I do have test names that have commas in the test name.

Any help would be GREATLY appreciated!

Reply With Quote
  #2  
Old July 2nd, 2010, 06:34 AM
Stealeannourn Stealeannourn is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2010
Posts: 1 Stealeannourn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 m 21 sec
Reputation Power: 0
ALO! intro

Hello I am new here. Im sorry if thisis not the right place for this but I was hopingsome one here on forums.devarticles.com would be able to help me accessfacebook from behind a firewall as it it is firewalled. Anyassistance would be appreciated.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Use a Javascript Function with multiple variables


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap