This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes hide textbox based on selection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "hide textbox based on selection" Watch "hide textbox based on selection" New topic
Author

hide textbox based on selection

Rajesh murthy
Greenhorn

Joined: Sep 30, 2008
Posts: 9
I am facing issues in hide and visibility of text box in jsp. whenever I am selecting a radio button I need to hide one textbox.It's working fine.the problem here is ,after hiding the space occupied by the text box is not removing,does any body know how to do it.Please help me,it's very urgent.
Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
Are you hidding it using javascript or logic in your JSP. Posting the JSP and any relevant javascript would help. Also, the html source that is creating the blank space might help as well.
Rajesh murthy
Greenhorn

Joined: Sep 30, 2008
Posts: 9
function hideText(value){
if(value =='GROSS'){
document.getElementById('GrossRatetxt').value = '';
document.getElementById('GrossRatetxt').disabled = false;
document.getElementById('grossDiv').style.visibility = 'visible';
document.getElementById('netDiv').style.visibility = 'hidden';
}
else if(value =='NET'){
document.getElementById('NetRatetxt').value = '';
document.getElementById('NetRatetxt').disabled = false;
document.getElementById('grossDiv').style.visibility = 'hidden';
document.getElementById('netDiv').style.visibility = 'visible';
}
}


div id="grossDiv" align="justify"

html:text property="grossRate"
styleClass="InputTxt10black" size="30" maxlength="10"
styleId="GrossRatetxt"
/html:text /span
/div

html:radio property="grossNetInd" value="GROSS"

styleId="Gross"
html:radio
Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
Maybe try putting each of your input fields in a <div>, then control the display by setting style.display of the div to either inline or none.
 
Don't get me started about those stupid light bulbs.
 
subject: hide textbox based on selection
 
Similar Threads
Strange - Page Submits!!!
hide dropdown list
Text box
keycode capturing not working
How to Edit Details in database using JSP page?