Focal Point
onclick event handling for Reset button

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5461016442

August 30, 2007, 04:44 PM
Dennis_V
onclick event handling for Reset button
Has anyone encountered this situation?

I have a Reset button on my form. I would like to fire some additional JavaScript code to manipulate other form controls that are not affected by the form reset when the Reset button is clicked.

When I try to add my JavaScript using the onclick event handler in Dev Studio, the form no longer resets when the button is clicked. The JavaScript, however, works fine.

Is there a JavaScript command that I could use to force the form reset? Is adding an onclick event handler to a Reset button invalid in the first place?

I've combed through the posts and didn't see anything that quite addresses this issue.

I'm running on the 7.1.4 server.

Thanks for any advice or info anyone has on this issue.

Dennis


Local: AppStudio 8.2.03 - Win7 - Tomcat Server: WebFOCUS 8.2.03 - Windows 2008 R2 Enterprise on VMWare 2 CPU, 3.2GHz, 4GB of RAM Output Formats: HTML, Excel, PDF, PPT, Active Reports
August 30, 2007, 05:27 PM
Tony A
Dennis,

Has the type of your button been changed from "RESET" to "BUTTON"?

If you want to force a form reset then your can use document.form.reset(); where form is the name of your form.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
August 31, 2007, 11:21 AM
Dennis_V
T,

Thanks. You've given me another direction to pursue. The chained controls I have are not behaving as expected when the Reset button is clicked, which led me to trying to add JavaScript code to the button to force the reset of certain controls.

Once I added the JavaScript, the Reset button does not reset all the chained objects. I have some chained controls that are read-only to provide extra information to the user, which may be causing this issue.

Based on your question about "Reset" vs "Button" for the button type, I had the idea to just create a regular button and add JavaScript to the onclick event to reset each of the objects to their default values. Probably not the most optimal solution, but for this particular form it works exactly as the user wants it to.

Thanks again,

Dennis


Local: AppStudio 8.2.03 - Win7 - Tomcat Server: WebFOCUS 8.2.03 - Windows 2008 R2 Enterprise on VMWare 2 CPU, 3.2GHz, 4GB of RAM Output Formats: HTML, Excel, PDF, PPT, Active Reports
August 31, 2007, 01:16 PM
Tony A
Dennis,

That's what I have turned to for the occasions when I need the same functionality.

The reason for the non resetting of the chained controls (I think) and also the non functioning of the onchange events, is primarily down to the ibirls2.js module. It causes any existing onchange events for a chained combo box to be over-riden by the ones created by ibirls2.js. A right pain in the neck but one that is surmountable by adding another onchange event via javascript.

Glad you got it working as per your users requirements.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10