Solved

onBlur event not firing script?

Posted on 2012-03-14
2
322 Views
Last Modified: 2012-03-14
Can someone please help me to understand why this onBlur event for this input box will not fire off a javascript?  If I press the SAVE button it works.  I want to eliminate the need to press the SAVE button.
<% if not rs2.bof and not rs2.eof then %>
	<% do until rs2.eof %>
		<form action="SplitTransSave.asp?proxyfor=<%= sUserName %>&mode=<%= sMode %>&TID=<%= rs2("TID") %>&amp;Orig=<%= Request.QueryString("TID") %>" method="POST" name="frm<%= rs2("TID") %>">
		<tr>
			<td align="left" bgcolor="<%= sBGColor %>" width="1%" nowrap><font face="verdana,tahoma,arial" size="1" color="#000000"><%= rs2("TID") %></font></td>
			<td align="left" bgcolor="<%= sBGColor %>" width="1%" nowrap><font face="verdana,tahoma,arial" size="1" color="#000000"><%= rs2("CHolderName") & ", " & rs("CHolderFName") %></font></td>
			<td align="left" bgcolor="<%= sBGColor %>" width="1%" nowrap><font face="verdana,tahoma,arial" size="1" color="#000000"><%= rs2("StmtDate") %></font></td>
			<td align="left" bgcolor="<%= sBGColor %>" width="1%" nowrap><font face="verdana,tahoma,arial" size="1" color="#000000"><%= rs2("TranDate") %></font></td>
			<td align="left" bgcolor="<%= sBGColor %>" width="1%" nowrap><font face="verdana,tahoma,arial" size="1" color="#000000"><%= rs2("PostDate") %></font></td>
			<td align="left" bgcolor="<%= sBGColor %>" width="1%" nowrap><font face="verdana,tahoma,arial" size="1" color="#000000"><%= rs2("Merchant") %></font></td>
			<td align="left" bgcolor="<%= sBGColor %>" width="1%" nowrap><font face="verdana,tahoma,arial" size="1" color="#000000">$</font><input type="text" name="txtTranAmt" value="<%= FormatNumber(rs2("TranAmt"),2) %>" onblur="javascript:bSave=1;" size="8" style="font-family: Tahoma; font-size: 7pt" /></td>
			<td align="left" bgcolor="<%= sBGColor %>" width="93%"><a href="javascript:doSave(<%= rs2("TID") %>);" onClick="javascript:bSave=1;"><img src="images/save.gif" border="0" alt="Save this transaction..." WIDTH="18" HEIGHT="18"></a></td>
		</tr>
		</form>
		<% rs2.movenext %>
		<% if sBGColor = "white" then %>
			<% sBGColor = "lightgrey" %>
		<% else %>
			<% sBGColor = "white" %>
		<% end if %>
	<% loop %>
<% end if %>

Open in new window

<script ID="clientEventHandlersJS" LANGUAGE="javascript">
<!--

var bSave = 0

function window_onload() 
{
document.frmChange.txtChange.value='0';
}

function window_onbeforeunload() 
{
	if(bSave==0)
	{
		document.location.href="SplitTransDel.asp?proxyfor=<%= sUserName %>&mode=<%= sMode %>&TID=<%= Request.QueryString("TID") %>";
	}
}

function window_onunload() 
{
	if(bSave==0)
	{
		document.location.href="SplitTransDel.asp?proxyfor=<%= sUserName %>&mode=<%= sMode %>&TID=<%= Request.QueryString("TID") %>";
	}
}

function doSave(nTID)
{
	eval('document.frm'+nTID+".submit();");
}

function doDone(nTID)
{
	document.location.href="SplitTransDone.asp?proxyfor=<%= sUserName %>&mode=<%= sMode %>&TID=<%= Request.QueryString("TID") %>";
}


//-->
</script>

Open in new window

0
Comment
Question by:Ahelbling
2 Comments
 
LVL 15

Accepted Solution

by:
pateljitu earned 500 total points
Comment Utility
You would need to call doSave function along with assign variable bSave with value 1, please try this line change:

<input type="text" name="txtTranAmt" value="<%= FormatNumber(rs2("TranAmt"),2) %>" onblur="javascript:bSave=1;doSave(<%= rs2("TID") %>);" size="8" style="font-family: Tahoma; font-size: 7pt" />
0
 

Author Closing Comment

by:Ahelbling
Comment Utility
Excellent.  Thank you!
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now