adusumalli
07-24-2009, 07:15 AM
HI ,
I strucked with the Check box value in my application. I have few fields in my table. One of the field has checkbox. When I am going to edit the other fields in this table. The Checkbox field is checked without doing update on check box field. In the following Code, i have the checkbox field.
buf.append( "<tr>" );
buf.append( " <td class=ppolFormPrompt><font color=#DA8009 size=4>*</font>First Name: </td>" );
buf.append( " <td class=ppolFormInput nowrap>" );
buf.append( " <input class=textInputSmall size=14 name=firstName value='"+c.getFirstName()+"'>" );
buf.append( " MI: <input class=textInputSmall size=2 name=middleName value='"+c.getMiddleName()+"'>" );
buf.append( " </td>" );
buf.append( "</tr>" );
buf.append( "<tr>" );
buf.append( " <td class=ppolFormPrompt><font color=#DA8009 size=4>*</font>Last Name: </td>" );
buf.append( " <td class=ppolFormInput nowrap>" );
buf.append( " <input class=textInputSmall size=26 name=lastName value='"+c.getLastName()+"'>" );
buf.append( " </td>" );
buf.append( "</tr>" );
buf.append( "<tr>" ); // this is checkbox field
buf.append( " <td class=ppolFormPrompt> </td>" );
buf.append( " <td class=ppolFormInput nowrap>" );
buf.append( " <input type=checkbox name=PRIVATE_CONTACT value='Y' > Private Contact" ); // "+(c.isPrivate()? "checked":"")+"
buf.append( " <input type=hidden name=__PRIVATE_CONTACT value=Y>" );
buf.append( " </td>" );
buf.append( "</tr>" );
After doing update in the table here i am going to set into Database.
if ( !_req.getParam("firstName").equals("") ) c.setFirstName( _req.getParam("firstName") );
if ( !_req.getParam("lastName").equals("") ) c.setLastName( _req.getParam("lastName") );
if ( _req.getParam("PRIVATE_CONTACT").equals("Y") )
c.setPrivate(true);
Here I am updating other fields. but checkbox field store it as 'checked' in database. In this condition if ( _req.getParam("PRIVATE_CONTACT").equals("Y") ) always it is equal to "Y". But it suppose to happend when i checked the checkbox then only it should equal to "Y". without checked the checkbox also the value equal to "Y" .
Can anybody give me an Idea on this.
thanks in advance.
I strucked with the Check box value in my application. I have few fields in my table. One of the field has checkbox. When I am going to edit the other fields in this table. The Checkbox field is checked without doing update on check box field. In the following Code, i have the checkbox field.
buf.append( "<tr>" );
buf.append( " <td class=ppolFormPrompt><font color=#DA8009 size=4>*</font>First Name: </td>" );
buf.append( " <td class=ppolFormInput nowrap>" );
buf.append( " <input class=textInputSmall size=14 name=firstName value='"+c.getFirstName()+"'>" );
buf.append( " MI: <input class=textInputSmall size=2 name=middleName value='"+c.getMiddleName()+"'>" );
buf.append( " </td>" );
buf.append( "</tr>" );
buf.append( "<tr>" );
buf.append( " <td class=ppolFormPrompt><font color=#DA8009 size=4>*</font>Last Name: </td>" );
buf.append( " <td class=ppolFormInput nowrap>" );
buf.append( " <input class=textInputSmall size=26 name=lastName value='"+c.getLastName()+"'>" );
buf.append( " </td>" );
buf.append( "</tr>" );
buf.append( "<tr>" ); // this is checkbox field
buf.append( " <td class=ppolFormPrompt> </td>" );
buf.append( " <td class=ppolFormInput nowrap>" );
buf.append( " <input type=checkbox name=PRIVATE_CONTACT value='Y' > Private Contact" ); // "+(c.isPrivate()? "checked":"")+"
buf.append( " <input type=hidden name=__PRIVATE_CONTACT value=Y>" );
buf.append( " </td>" );
buf.append( "</tr>" );
After doing update in the table here i am going to set into Database.
if ( !_req.getParam("firstName").equals("") ) c.setFirstName( _req.getParam("firstName") );
if ( !_req.getParam("lastName").equals("") ) c.setLastName( _req.getParam("lastName") );
if ( _req.getParam("PRIVATE_CONTACT").equals("Y") )
c.setPrivate(true);
Here I am updating other fields. but checkbox field store it as 'checked' in database. In this condition if ( _req.getParam("PRIVATE_CONTACT").equals("Y") ) always it is equal to "Y". But it suppose to happend when i checked the checkbox then only it should equal to "Y". without checked the checkbox also the value equal to "Y" .
Can anybody give me an Idea on this.
thanks in advance.