By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,986 Members | 1,944 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,986 IT Pros & Developers. It's quick & easy.

isBlank and inline javascript

P: n/a
tlk
I have a function that is used to take the contents of various text
boxes, sum them, and write the results to another text box. I have
this function set-up to handle the constiuent text boxes' onBlur
events, and it works great. One of the things it does is it uses the
isBlank method of the string containing the contents of each text box
before it tries to do math on it:

function checkTotal(clientID,id) {
..
..
..
e = document.getElementById(clientID);
if (e) {
strValue=e.value.toString();
alert(strValue);
if (!strValue.isBlank())
..
..
..

I want this script to run when the page loads. This code is generated
deep in an ASP.Net user control, and I can't come-up with a good way to
execute this code in the page's body's onLoad. So I am writing the
following as in-line JavaScript at the bottom of the FORM:
<script language="JavaScript">
checkTotal('txtBudgetLaborHours','BudgetLaborHours ');
</script>

The function executes fine up until it gets to the isBlank method.
I've used alert's to verify that the text box in fact does have the
proper value when this method is called, but when the script goes to
execute the isBlank method I'm getting an "object does not support this
property or method" error.

Has anyone seen anything like this before? Is there a reason the
isBlank function isn't available at this point in the page's life?

thanks!

Feb 3 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a

tlk wrote:
I want this script to run when the page loads. This code is generated
deep in an ASP.Net user control, and I can't come-up with a good way to
execute this code in the page's body's onLoad.
You mean to say you can't do the following?

window.onload = function()
{
checkTotal("txtBudgetLaborHours", "BudgetLaborHours");
}
The function executes fine up until it gets to the isBlank method.
I've used alert's to verify that the text box in fact does have the
proper value when this method is called, but when the script goes to
execute the isBlank method I'm getting an "object does not support this
property or method" error.

Has anyone seen anything like this before? Is there a reason the
isBlank function isn't available at this point in the page's life?


The message means exactly what it says. Strings do not have an isBlank
method.

Feb 3 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.