Hi, I have a jsp screen in which there are so many text boxes. There is a button at the bottom of the screen. This button will be initially disabled. Once I click on any of the text boxes, the button should be enabled. Can anyone tell me how can I do that without calling a function in the onchange event of every textbox control. [ December 07, 2007: Message edited by: Bear Bibeault ]
Never tired...
SCJP SCWCD INS21 INS22 INS23 Salesforce Dev401
You could do it on the onclick of the body tag, and then you can set focus to the first text box and then enable the button. The only problem is that if they click on a specific text box you will be taking the focus out of the box that was just clicked on.
Why have the button disabled in the first place if the only criteria to enable it is that they click inside of a text box? That's not really any criteria at all.
Actually, the user will enter some criteria in one or more of the text boxes and then click on the button which in my case is a "Run Report" button. Once that is clicked, it will be disabled so that the user cannot submit the same report again. The user should be able to submit the report only when he changes the criteria. For that reason, I want to check whether the user clicks on any of the text box even though he does not change the criteria. I am not sure if there is a way to check whether the criteria is changed without adding any complex code.
Never tired...
SCJP SCWCD INS21 INS22 INS23 Salesforce Dev401
If a report takes long time to come back, the user will hit the same report again thinking it is still not submitted. I want to limit that as it creates unnecessary traffic. There are so many text boxes in the screen. Adding event listener for each text box will have so much impact. Is there any other way I can handle this? [ December 07, 2007: Message edited by: Lee Sha ]
Never tired...
SCJP SCWCD INS21 INS22 INS23 Salesforce Dev401
Doing the following just says they clicked on a textbox, it does not give you any info that they actually added data. Plus it does not work if they use tab to fill in the form.
Now you can have JavaScript add the event handlers
I wrote both of them here untested so they maybe buggy.
Do you have some sort of time constraints? Just add the listeners. If you do it right you will be much happier with the results and they will be much more controlled.
I do not have any time constraints. This is not the only screen that I have to change. There are some 30 screens. Each screen has nearly 30 to 40 controls. That is the reason why I was trying to control it from one function.
Never tired...
SCJP SCWCD INS21 INS22 INS23 Salesforce Dev401