want to clear previous text content of text field before accessing .......
I want to clear previous text content of text field before accessing page again, I had made a search page and when i enter a name in text page and then go to next page but when i do the search again, the name text box still has the previous name there,i want to clear that previous value before opening the page again.
Thanks in advance for any help on this.
[371 byte] By [
newbeana] at [2007-11-27 8:10:10]

# 1
function resetOnLoad() { document.getElementById("searchboxname").value = '';}call the fn, in the body onload of search pagelike, <body onload="resetOnLoad()">
skp71a at 2007-7-12 19:53:36 >

# 2
Thanks a lot! it is working fine.Thanks a lot again.
I have one more problem to resolve, i will be thankful for the suggestions ,it is regarding prepared statement ,I had written prepared statement to update the database,my problem is if i do not enter data in all the fields it dose not update the database and if i enter data in all the fields it dose,but i need to update database even data only in few fields and rest can be entered and updated as needed afterwards.
thanks and regards.
# 3
check out what I have done in my last project: No need to update all the fields at the same time. But, if you declared the table fields as NOT NULL, it has to have some value.
public void update(String mkt, String rKey, String user, String mKey) throws SQLException
{
try {
String update = market.getString("updatemkt");
con = Database.getConnection();
ps = con.prepareStatement(update);
//this is to remove extra spaces between words and leading and trailing spaces
java.util.StringTokenizer st = new java.util.StringTokenizer(mkt, " \t");
StringBuffer buf = new StringBuffer();
while (st.hasMoreTokens()) {
buf.append(" ").append(st.nextToken());
}
String mkt1 = buf.toString().trim();
ps.setString(1, mkt1);
ps.setString(2, rKey);
ps.setString(3, date);
ps.setString(4, user);
ps.setString(5, mKey);
ps.executeUpdate();
} finally {
if (rs != null)
rs.close();
if (ps != null)
ps.close();
if (con != null)
con.close();
}
}
skp71a at 2007-7-12 19:53:36 >
