Process Mapping Logo

Process Mapping - Forums

Sharing 19 years of knowledge and experience

 
Metastorm BPM forums
Sign up Latest Topics
 
 
 


Reply
  Author   Comment  
Jerome

Avatar / Picture

Guru
Registered:
Posts: 5,507
Reply with quote  #1 

Clicking a Button From a Client-Side Script

Created: 17 Jan 2006


The information in this article applies to product: e-Work 6.x

Issue

  • How can one click a button on a form from a client-side script?

Resolution

  • Here are two sample scripts that do that. For example, they can be called from the                                 client extensions of a form using OnLoad=ButtonClickTest()&Language=JScript [VBScript].

                                    VBScript:
                                    Sub ButtonClickTest()
                                              eworkData.FieldByName("ButtonName").HTMLfield.onfocus()
                                              eworkData.FieldByName("ButtonName").HTMLfield.onclick()
                                    End Sub

                                    JScript:
                                    Function ButtonClickTest()
                                    {
                                              eworkData.FieldByName("ButtonName").HTMLfield.onfocus();
                                              eworkData.FieldByName("ButtonName").HTMLfield.onclick();
                                    }                                

Keywords: kb697


__________________
Post an example, and we will have a much better idea what the problem is. In about 90% of posts, the problem is one of communication. Examples bridge that gap.
0
Jerome

Avatar / Picture

Guru
Registered:
Posts: 5,507
Reply with quote  #2 
I imagine this is completely unsupported

__________________
Post an example, and we will have a much better idea what the problem is. In about 90% of posts, the problem is one of communication. Examples bridge that gap.
0
loophole64

Member
Registered:
Posts: 42
Reply with quote  #3 

FYI, the 'f' in function for the jscript should be lowercase.


__________________
Jason Kelley
SRA International
0
erasmus

Member
Registered:
Posts: 12
Reply with quote  #4 
This also causes issues with occasionally causing a doubleclick on the button.  Seems to only be an issue on admin forms?
0
Carolyn

Member
Registered:
Posts: 27
Reply with quote  #5 
Since this was one of the things I had to rewrite for my v9 upgrade, I'd have a fair guess and say, no it wasn't supported.

When you get to v9 you click button from javascript like this:

function ServerSideClick(ButtonName)
{
   var ne = document.createEventObject();
   document.all[ButtonName].fireEvent("onclick", ne);
}



0
Jerome

Avatar / Picture

Guru
Registered:
Posts: 5,507
Reply with quote  #6 
I believe there is a ButtonClick() JScript function or similar now (9.0.2)
__________________
Post an example, and we will have a much better idea what the problem is. In about 90% of posts, the problem is one of communication. Examples bridge that gap.
0
kaan

Member
Registered:
Posts: 45
Reply with quote  #7 
That's right.

ButtonClick('ButtonName');

is the syntax to use and it works without any issues. Having said that, you might need to set the focus on the right field 

document.getElementById('ButtonName').focus();

Kaan
0
Jerome

Avatar / Picture

Guru
Registered:
Posts: 5,507
Reply with quote  #8 
I have used this now. It works very well.

There does not seem to be a need to set the focus.

__________________
Post an example, and we will have a much better idea what the problem is. In about 90% of posts, the problem is one of communication. Examples bridge that gap.
0
HoustonDev

Member
Registered:
Posts: 32
Reply with quote  #9 

It is buttonClick with lower case b :)

0
Jerome

Avatar / Picture

Guru
Registered:
Posts: 5,507
Reply with quote  #10 
The great thing about standards is there are so many to choose from!

__________________
Post an example, and we will have a much better idea what the problem is. In about 90% of posts, the problem is one of communication. Examples bridge that gap.
0
RMiranda

Member
Registered:
Posts: 25
Reply with quote  #11 
Quote:
Originally Posted by Jerome

Clicking a Button From a Client-Side Script

Created: 17 Jan 2006


The information in this article applies to product: e-Work 6.x

Issue

  • How can one click a button on a form from a client-side script?

Resolution

  • Here are two sample scripts that do that. For example, they can be called from the                                 client extensions of a form using OnLoad=ButtonClickTest()&Language=JScript [VBScript].

                                    VBScript:
                                    Sub ButtonClickTest()
                                              eworkData.FieldByName("ButtonName").HTMLfield.onfocus()
                                              eworkData.FieldByName("ButtonName").HTMLfield.onclick()
                                    End Sub

                                    JScript:
                                    Function ButtonClickTest()
                                    {
                                              eworkData.FieldByName("ButtonName").HTMLfield.onfocus();
                                              eworkData.FieldByName("ButtonName").HTMLfield.onclick();
                                    }                                

Keywords: kb697



Hi, I have started working with ver7, and would like to know if is it possible to click on a hidden button(Visibility depends on: "Don't Show") without using onfocus().
The problem is when the button is dynamically clicked, the field with the current focus loses it, and the cursor goes to the top of the page, this as you can imagine  increases the number of human errors. Any suggestions?
0
Jerome

Avatar / Picture

Guru
Registered:
Posts: 5,507
Reply with quote  #12 
I would try without setting the focus, and see if it works.

I would also try the aforementioned approach which may work in version 7 too:
Quote:
function ServerSideClick(ButtonName)
{
   var ne = document.createEventObject();
   document.all[ButtonName].fireEvent("onclick", ne);
}


__________________
Post an example, and we will have a much better idea what the problem is. In about 90% of posts, the problem is one of communication. Examples bridge that gap.
0
RMiranda

Member
Registered:
Posts: 25
Reply with quote  #13 
without the onfocus(), the button onclick() doesn't takes effect, same thing with you ServerSideClick, because it doesn't focus the button. But after some more testing i see that cursor jumps to the top not in the onfocus, but on the onclick, even if the buttons click action does nothing...so i believe the only solution is to find an alternative.
0
RMiranda

Member
Registered:
Posts: 25
Reply with quote  #14 

I have find out through some more debuging that the cursor jumps in the onlcick function, in the following:

    function ClickButton(buttonname)
    {
        eworkData.FieldByName(buttonname).HTMLfield.onfocus();
        eworkData.FieldByName(buttonname).HTMLfield.onclick();
        clearInterval(IntervalID);
        win=null;
    }

Now my dilemma is, the button must be clicked because it affects a costume variable with a SQL Server returned value, needed in the rest of the interface, but would need the cursor not to jump when the button is clicked, is this possible in anyway?
0
Jerome

Avatar / Picture

Guru
Registered:
Posts: 5,507
Reply with quote  #15 
I guess you could try calling the onfocus event of the field you just left? Not really a metastorm problem, so I can't help much, sorry.

__________________
Post an example, and we will have a much better idea what the problem is. In about 90% of posts, the problem is one of communication. Examples bridge that gap.
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:


Create your own forum with Website Toolbox!