Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OnMouseDown Javascript Problem

Status
Not open for further replies.

teblack

Programmer
Apr 30, 2004
45
I have a asp page that display a table of people with a radio button to select that individual for editing. Currently once you select a radio button you then click "SELECT" button. But the users want the page to fire imediatly once a radio button is selected, thus removing the second step of pressing the "SELECT" button. The attached code is what I'm using to attempting to use. Once the radio button is selected, that indx value is supposed to be sent to the next page for use in retireval of the correct data, it. The problem is that we can not get the index value (I) passed over to the next screen.

for i = 0 to UBound(vaCompanyUsers,2)
userpkkey = vaCompanyUsers(FldPos("pk_contactid",saCompanyUsersFieldNames),i)
userfname = vaCompanyUsers(FldPos("firstname",saCompanyUsersFieldNames),i)
userlname = vaCompanyUsers(FldPos("lastname",saCompanyUsersFieldNames),i)
Code:
		userphone		= FormatPhone(vaCompanyUsers(FldPos("phone",saCompanyUsersFieldNames),i))
		userphoneext	= vaCompanyUsers(FldPos("phoneext",saCompanyUsersFieldNames),i)
		userfax			= FormatPhone(vaCompanyUsers(FldPos("fax",saCompanyUsersFieldNames),i))
		userfaxext		= vaCompanyUsers(FldPos("faxext",saCompanyUsersFieldNames),i)
		userid			= vaCompanyUsers(FldPos("username",saCompanyUsersFieldNames),i)
		useremail		= vaCompanyUsers(FldPos("email",saCompanyUsersFieldNames),i)

		phones			= ""
		if userfax > "" then
				phones = phones & userphone & " ext. " & userphoneext & "<br>"
				phones = phones & userfax 
		else
				phones = phones & userphone & " ext. " & userphoneext
		end if		
			
		roles			= ""
		if vaCompanyUsers(FldPos("isAdministrator",saCompanyUsersFieldNames),i) > 0 then
			roles = roles & "Administrator <br>"
		end if			
		if vaCompanyUsers(FldPos("isPaymentEntry",saCompanyUsersFieldNames),i) > 0 then
			roles = roles & "Payment Scheduler <br>"
		end if		
		if vaCompanyUsers(FldPos("isPaymentApprover",saCompanyUsersFieldNames),i) > 0 then
			roles = roles & "Payment Approver <br>"
		end if		
		if vaCompanyUsers(FldPos("isNewHireEntry",saCompanyUsersFieldNames),i) > 0 then
			roles = roles & "New Hire Reporter"
		end if	
		if vaCompanyUsers(FldPos("isBasicUser",saCompanyUsersFieldNames),i) > 0 then
			roles = roles & "Basic User"
		end if		  	     
	  %>	     
	    <tr>      
			<%if Session("loginid") = userpkkey or Session("isAdministrator") = true then %>
				<td valign="top" align="center" width="60">
					<input type="radio" name="selected<%=i%>" value="<%=i%>"
						onmousedown="javascript: document.UserSelect_Form.selected.value = 
							document.UserSelect_Form.selected<%=i%>.value;
							document.UserSelect_Form.submit();">		
			   	</td>
			<%else%>
				<td valign="top" align="center" width="60" bgcolor=DarkGray><input type="radio" name="selected1" id="selected1" disabled value="<%=i%>"></td>
			<%end if%>				
			<td valign="top" align="center" width="175"><%=rtrim(userfname)%>&nbsp;<%=rtrim(userlname)%></td>
			<td valign="top" align="center" width="60"><%=userid%></td>
			<td valign="top" align="left"   width="200"><%=phones%></td>
			<td valign="top" align="center" width="175"><%=useremail%></td>
			<td valign="top" align="center" width="175"><%=roles%></td>
	     </tr>
	  <%Next %>
</table>
<input type="hidden" name="selected">


Any suggestion"?

Thanks in advance for the help

TBlack -
 
Instead of using a hidden field, why not name all your radio buttons the same? Only the checked value will be passed.

Adam

¡ph ¥0u c4n r34d d¡5 ¥0u n33d 70 g37 l4¡d
 
I have changed to using a onclick event, and everything works good, but I'm also trying to make this useable for the keyboard, so when I change it over to onmousedown or onkeypress it does not pass the 'selected' value to the next page.

Thanks in advance for the help.





TBlack -
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top