Advertisement

08.19.2008 at 09:13AM PDT, ID: 23660143
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.2

How to dynamically disable or enable form elements using Javascript and passing the elementID as the variable.

Asked by chuckycharms00 in JavaScript, VB Script

Tags:

I have a form that is being built dynamically based on a numerical integer in the specific record. It is being used to create a team for a specific tournament. If the team size for that tournament is x then there will be x-1 spots for you to invite other participants. In order to invite the participants you're given the choice of choosing the user from a List/Menu that is queried off of our database or you mail email an unregistered user.

I'd like to have a radio button in front of both the text field(for the email) and the list/menu (for the registered users) that enabled the corresponding element. My problem is the elementID will be dynamically changing there could be team size as far up as 64 or as low as 2. My initial thought was to pass the elementID to the javascript function and approach it that way but I don't believe I can reference the elementID via variable. Any help at all would be very appreciated. I am not hell-bent on using these methods just what seemed easiest and most efficient at the time. Here is a summary of something I was looking for.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
<script language="javascript">
function EnableDisableFields(enabledfield, disabledfield){
     document.form1.enabledfield.disabled=false;
     document.form1.enabledfield.disabled=true;
}
</script>
 
   <%
	  'Get the amount of other gamers
	  teamsize = current_tournament.Fields.Item("teamsize").Value
	  'Display the invite gamers the correct amount of times
	  For i=2 to teamsize
	  txtgamertag = "txtgamertag" & i
	  txtemail = "txtemail" & i
   %>
      <tr>
        <td>Gamer:</td>
        <td width="6%">
            <input name="invite<%=i%>" type="radio" id="invite_<%=i%>" value="chkgamertag<%=i%>" checked="checked" onclick="EnableDisableFields("<%=txtgamertag%>", "<%=txtemail%>")"/>        </td>
        <td width="26%"><select name="txtgamertag<%=i%>" id="gamers">
          <option value="null"selected="selected">Select One...</option>
          <%
	While (NOT gamers_toinvite.EOF)
		'If the gamer is not in a team in this tournament then show in drop down
		If InStr(gamers_toinvite.Fields.Item("teams").Value, "-" & Request.Cookies("tournament") & ".") = 0 Then 
			iftester = iftester + 1
			%><option value="<%=gamers_toinvite.Fields.Item("ID").Value%>"><%=gamers_toinvite.Fields.Item("gamertag").Value%></option>
		<%
		End If 'End If the gamer is not in a team
		gamers_toinvite.MoveNext()
	Wend
 
        %>
        </select></td>
        <td width="3%"><input type="radio" name="invite<%=i%>"  id="invite_<%=i%>" value="chkemail<%=i%>"onclick="EnableDisableFields("<%=txtemail%>", "<%=txtgamertag%>")"/></td>
        <td width="32%"><input type="text" name="txtemail<%=i%>"  id="txtemail<%=i%>" value="" maxlength="100" disabled="true"/></td>
      </tr>
 	<%Next%>
 
Keywords: How to dynamically disable or enable f…
 
Loading Advertisement...
 
[+][-]08.19.2008 at 09:37AM PDT, ID: 22261442

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: JavaScript, VB Script
Tags: ASP and Javascript
Sign Up Now!
Solution Provided By: hielo
Participating Experts: 1
Solution Grade: A
 
 
[+][-]08.19.2008 at 09:49AM PDT, ID: 22261537

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628