Solved

onBlur event not firing script?

Posted on 2012-03-14
2
334 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Accepted Solution

by:
pateljitu earned 500 total points
ID: 37722068
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
ID: 37722088
Excellent.  Thank you!
0

Featured Post

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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

749 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