• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 111
  • Last Modified:

how can i send two parameters in a script?

we have a form, (see file attached), when i select a box, the radio button "yes" should be selected by script

<SCRIPT>
function GETONcheck(i)
{
document.getElementById(i).checked = true;

}
</SCRIPT>

Open in new window



 	<INPUT id=radio8 type=radio name=q17 value="1" <% if fq17 = "1" then response.write "checked" end if  %> >
  				<%=q20%>&nbsp;</td>
			   	<td>
				</td>
		   	</tr>
			 <tr>
			   	<td style="height: 21px">
			   	<INPUT id=radio9 type=radio name=q17 value="2" <% if fq17 = "2" then response.write "checked" end if  %>>
			   	<%=q21 %>&nbsp;</td>
			   	<td style="height: 21px"></td>
	   		 </tr>

	   		 
	   		 
		   	
			   		 
			   		 
			   		 
					 <tr>
					
			   	<td>
			   	<table cellpadding="0" cellspacing="0" style="width: 100%">
					<tr>
						<td width="25px">&nbsp;</td>
						<td><INPUT id=q18 type=checkbox name=q18 onchange="GETONcheck('q17')"  <%if request.querystring("fq18") = "on" then response.write "checked" end if  %>>&nbsp;<%=q30 %></td>
					</tr>
					<tr>
						<td>&nbsp;</td>
						<td><INPUT id=q19 type=checkbox name=q19 onchange="GETONcheck('q17')" <%if request.querystring("fq19") = "on" then response.write "checked" end if  %>>&nbsp;<%=q31 %></td>
					</tr>
					<tr>
						<td>&nbsp;</td>
						<td><INPUT id=q20 type=checkbox name=q20 onchange="GETONcheck('q17')" <%if request.querystring("fq20") = "on" then response.write "checked" end if  %>>&nbsp;<%=q32 %></td>
					</tr>
					<tr>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
					</tr>
				</table>

Open in new window




so, if i check box 18, 19 or 20, radiobutton 17 has to be checked, with value 2 (in this case, true).

you know how to do that?
B--script.png
0
fedkris
Asked:
fedkris
  • 3
  • 2
  • 2
  • +1
1 Solution
 
Luis PérezSoftware Architect in .NetCommented:
Replace your
onchange="GETONcheck('q17')"
with
onchange="GETONcheck('radio9')"

Because inside GETONcheck you use GetElementById, the Id of the radiobutton is "radio9", not "q17".

Hope that helps.
0
 
fedkrisAuthor Commented:
hi, thx for answer, when i change that, he doesn't check the checkbox (yes)...
0
 
Luis PérezSoftware Architect in .NetCommented:
Have you changed it in all your checkboxes (three of them)?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
fedkrisAuthor Commented:
yes, but it doesn"t work
0
 
Luis PérezSoftware Architect in .NetCommented:
Can you post your actual code (with changes inserted)?
0
 
RobOwner (Aidellio)Commented:
I think  you need a structure to control your logic such as knockoutjs & jquery

Here is a demo of what you want utilising knockout: http://jsbin.com/necij/1/edit?html,js,output

<!DOCTYPE html>
<html>
	<head>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/knockout/3.0.0/knockout-min.js"></script>
		<meta charset="utf-8">
		<title>JS Bin</title>
	</head>
	<body>
		<table>
			<tr><td>
		<input id='radio8' type='radio' name='q17' value="1" data-bind="enable: mytest()==1,checked: mytest"/>q17-1
		&nbsp;</td>
		<td>
		</td>
		</tr>
	<tr>
		<td style="height: 21px">
			<input id='radio9' type='radio' name='q17' value="2" data-bind="checked: mytest"/>q17-2
			&nbsp;</td>
		<td style="height: 21px"></td>
	</tr>
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" style="width: 100%">
				<tr>
					<td width="25px">&nbsp;</td>
					<td><input id='q18' type='checkbox' name='q18' data-bind="checked: q18" />q18</td>
				</tr>
				<tr>
					<td>&nbsp;</td>
					<td><input id='q19' type="checkbox" name='q19' data-bind="checked: q19" />q19</td>
				</tr>
				<tr>
					<td>&nbsp;</td>
					<td><input id='q20' type='checkbox' name='q20' data-bind="checked: q20" />q20</td>
				</tr>
				<tr>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
				</tr>
			</table>
	</body>
</html>

Open in new window


$(function() {
	viewmodel = {
		q18: ko.observable(false),
		q19: ko.observable(false),
		q20: ko.observable(false),
		myradio: ko.observable()
	};
	viewmodel.mytest = ko.computed({
		read: 
		function(){
			if (viewmodel.q18() || viewmodel.q19() || viewmodel.q20())
				return "2";

			return "1";
		},
		write: function(val) {
			viewmodel.myradio(val);
		}
	});

	ko.applyBindings(viewmodel);
});

Open in new window

0
 
GaryCommented:
I've requested that this question be deleted for the following reason:

The question has either no comments or not enough useful information to be called an "answer".
0
 
RobOwner (Aidellio)Commented:
Fully working demo in my comment

http:#a40243127
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now