Saturday, August 25, 2007

Show Hide using display.style in javascript problem in Firefox

An already javascript function was used to show/hide an array of elments in an HTML page.
It worked perfectly in IE but in Firefox it gave a problem when we used to show/hide multiple times on an element. A new row/column was added in every iteration of show hide.

On investigation, a single line code change made in work fine in both IE and firefox

Old Code
function showHideElement(elementId, showHideFlag) {
var elementObj = document.getElementById(elementId);
if(showHideFlag == 1) {
elementObj.style.display = 'block';
} else if(showHideFlag == 0) {
elementObj.style.display = 'none';
}
}
New Code
function showHideElement(elementId, showHideFlag) {
var elementObj = document.getElementById(elementId);
if(showHideFlag == 1) {
elementObj.style.display = '';
} else if(showHideFlag == 0) {
elementObj.style.display = 'none';
}
}
A single line change from elementObj.style.display = 'block' to elementObj.style.display = '' stopped creation of blank rows/columns on every iteration of show hide

http://www.ozzu.com/ftopic41924.html
http://www.velocityreviews.com/forums/t160487-firefox-and-stylequotdisplayblockquot-on-table-row.html

Friday, August 10, 2007

Wednesday, July 11, 2007

No form found under 'null' in locale 'en_US'. A form must be defined in the Commons Validator configuration when dynamicJavascript=&q

As soon as I put <html:javascript /> tag in the jsp, I get this error.
It indicates that it is unable to find a formset.

Solution: Did not add the form name with the tag
ex:

The path of an ForwardConfig cannot be null

Usually, this is an indication that you have validation turned on, the
validation is failing, and the "input" attribute is not set (i.e. it's
NULL)
Source

I was adding validator and forgot to do 'validation="true"' add the 'input' attribute in action mapping

Tuesday, March 27, 2007

java.sql.SQLException: ORA-01008: not all variables bound

One of the cause of this error can be found in the following snippet of code:

query = "select * from AAA where condn = ?";
pstmt = con.prepareStatement(query);
pstmt.setString(1, firstValue);
// ResultSet rs = pstmt.executeQuery(query); // Wrong Usage - Do not provide query again
ResultSet rs = pstmt.executeQuery(); // Correct Usage

Another reason is that you have not mapped all '?' with corresponding values