If somehow you are trying to validate dates that involves 2 drop downs and the values in the drop down are set, you can do the following.
function validateDate(dateToCheck, selectedDay)
{
var totalMonthCount = 12;
var i = 1;
var isValid = true;
var monthToCheck = parseInt(dateToCheck.getMonth());
var yearToCheck = parseInt(dateToCheck.getFullYear());
if(selectedDay > 28)
{
if(monthToCheck == 2)
{
if(yearToCheck%4 == 0)
{
if(selectedDay > 29)
{
isValid = false;
}
}
else
{
isValid = false;
}
}
if((monthToCheck == 4) || (monthToCheck == 6) || (monthToCheck == 9) || (monthToCheck == 11))
{
if(selectedDay > 30)
{
isValid = false;
}
}
}
return isValid;
}
Friday, July 23, 2010
Mobile web development issues
Show-Hide display
To show-hide a loading screen, you would have to ensure that javascript does an unload on the body tag.
In it, you would want to hide (css display = 'none') for the loading screen section. I've used DIVs for the loading screen section.
HTML links & runat="server"
You will have to ensure that the "href" attribute contains "javascript:;" in the event that you intend to add the runat="server" attribute to your HTML links.
To show-hide a loading screen, you would have to ensure that javascript does an unload on the body tag.
In it, you would want to hide (css display = 'none') for the loading screen section. I've used DIVs for the loading screen section.
HTML links & runat="server"
You will have to ensure that the "href" attribute contains "javascript:;" in the event that you intend to add the runat="server" attribute to your HTML links.
Thursday, July 22, 2010
Software Development - Project Managers
This post is a rant. If you don't like a rant, I suggest skipping this.
I am intruiged at the fact that IT Project Managers will allow untested software to be released to the world.
I am beginning to feel that in the corporate world, software developers are the most unappreciated people and also I am having the inkling that project managers are not operating at effective levels.
According to wikipedia, project management is the discipline of planning, organizing, and managing resources to bring about the successful completion of specific project goals and objectives.
And if a software developer is a resource to the project, my argument is, does this mean that the resource is not being managed properly? Does this than equate to the fact that the project manager is not performing their role to a sufficient and acceptable level?
Yes, sufficient and acceptable is subjective, however, when a Software Development project is over cost, delivered past the deliverable date, who is to blame?
From experience, the blame falls squarely at the feet of the developer. The word around the water cooler is, "so and so is doing a bad job, he's not delivering the project". However, my question is, is the developer solely to be blamed for the ludicrious time-line and deliverable date set by the Project Manager?
My question than is, who set the time-line?
Who spoke to the client and made the promise to the client that at a certain date, the project is going to be delivered?
Do they understand the intricacies of software development?
Was testing done prior to release?
Does the project manager understand that the computer is nothing but a dumb terminal that has to be told in specific fine minute details to perform a certain task?
I am intruiged at the fact that IT Project Managers will allow untested software to be released to the world.
I am beginning to feel that in the corporate world, software developers are the most unappreciated people and also I am having the inkling that project managers are not operating at effective levels.
According to wikipedia, project management is the discipline of planning, organizing, and managing resources to bring about the successful completion of specific project goals and objectives.
And if a software developer is a resource to the project, my argument is, does this mean that the resource is not being managed properly? Does this than equate to the fact that the project manager is not performing their role to a sufficient and acceptable level?
Yes, sufficient and acceptable is subjective, however, when a Software Development project is over cost, delivered past the deliverable date, who is to blame?
From experience, the blame falls squarely at the feet of the developer. The word around the water cooler is, "so and so is doing a bad job, he's not delivering the project". However, my question is, is the developer solely to be blamed for the ludicrious time-line and deliverable date set by the Project Manager?
My question than is, who set the time-line?
Who spoke to the client and made the promise to the client that at a certain date, the project is going to be delivered?
Do they understand the intricacies of software development?
Was testing done prior to release?
Does the project manager understand that the computer is nothing but a dumb terminal that has to be told in specific fine minute details to perform a certain task?
Tuesday, July 20, 2010
dotNet URL
Using the HTTP Request object from the current HTTP context, can return a few different URL path.
To retrieve just the URL without the query string variables, use
RequestObject.CurrentExecutionFilePath
To retrieve the entire URL with query string variables, use
RequestObject.RawURL
There are other important bits that we can use too.
To retrieve just the URL without the query string variables, use
RequestObject.CurrentExecutionFilePath
To retrieve the entire URL with query string variables, use
RequestObject.RawURL
There are other important bits that we can use too.
Friday, July 16, 2010
ASP.Net custom validator with javascript
To validate controls using javascript, just so you can use it for XUI or jQuery or whatever Web 2.0 library you use, you can simply declare a ASP.Net Custom Validator as such and have the ClientValidationFunction to be your javascript validator function;
<asp:CustomValidator ID="someVal" runat="server" ClientValidationFunction="jsValidator"></asp:CustomValidator>
Then, in the section of where your javascript code resides, can be in a file or at the top of the same page, declare a function as such.
function jsValidator(args, sender)
{
//Insert validation here.
//To set the error message on the ASP.Net validator control, just use the
//sender object as such;
//sender.errormessage = "Some error message";
//Also, remember to set the isValid boolean flag, "args.IsValid"
}
<asp:CustomValidator ID="someVal" runat="server" ClientValidationFunction="jsValidator"></asp:CustomValidator>
Then, in the section of where your javascript code resides, can be in a file or at the top of the same page, declare a function as such.
function jsValidator(args, sender)
{
//Insert validation here.
//To set the error message on the ASP.Net validator control, just use the
//sender object as such;
//sender.errormessage = "Some error message";
//Also, remember to set the isValid boolean flag, "args.IsValid"
}
Javascript - retrieving the drop down selected value
I copied this from the Tek-Tips forum just so I have a repository of it.
<head>
<title>New Page 10</title>
<script Language="JavaScript">
function checkData()
{
var myTest = me.D1.selectedIndex.value;
alert(myTest);
}
</script>
</head>
<body>
<form method="POST" name="me">
<select size="1" name="D1" onChange="checkData()">
<option value="99">Default</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
</body>
</html>
selectedIndex, when used correctly, returns the index (number) of the space in the options collection in which the selected option resides.
Here's what you want to use:
me.D1.options[me.D1.selectedIndex].value
I think that's it. Try the following if not:
me.D1.options[me.D1.options.selectedIndex].value
<head>
<title>New Page 10</title>
<script Language="JavaScript">
function checkData()
{
var myTest = me.D1.selectedIndex.value;
alert(myTest);
}
</script>
</head>
<body>
<form method="POST" name="me">
<select size="1" name="D1" onChange="checkData()">
<option value="99">Default</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
</body>
</html>
selectedIndex, when used correctly, returns the index (number) of the space in the options collection in which the selected option resides.
Here's what you want to use:
me.D1.options[me.D1.selectedIndex].value
I think that's it. Try the following if not:
me.D1.options[me.D1.options.selectedIndex].value
Thursday, July 15, 2010
ASP.Net hidden fields and XUI
After fiddling around with XUI, I realized that there is no function within to retrieve the hidden input values similar to jQuery.
Thus, the hacked way around it is to declare a HTML tag, eg: a span, paragraph or even div and make the CSS display style as hidden.
You will also have to assign it a class and then you will be able to obtain it using XUI and plain ol' javascript by using the XUI selector and then adding .elements[0].innerHTML to the end of it.
NOTE: Javascript is case sensitive and innerHTML doesn't work if you'd typed it innerHtml
Thus, the hacked way around it is to declare a HTML tag, eg: a span, paragraph or even div and make the CSS display style as hidden.
You will also have to assign it a class and then you will be able to obtain it using XUI and plain ol' javascript by using the XUI selector and then adding .elements[0].innerHTML to the end of it.
NOTE: Javascript is case sensitive and innerHTML doesn't work if you'd typed it innerHtml
Subscribe to:
Posts (Atom)