Process Mapping Logo

Process Mapping - Forums

Sharing 19 years of knowledge and experience

 
Metastorm BPM forums
Sign up Latest Topics
 
 
 


Reply
  Author   Comment  
sourabh_en

Member
Registered:
Posts: 30
Reply with quote  #1 

Hi I need the code for overriding the onclick event of button in jscript as it doesnot return false rather it goes server side .I think  by overriding we can return false.


__________________
Attitude is a little thing that makes a big difference.
websites: http://www.metastormhelp.info/
0
Pete

Senior Veteran
Registered:
Posts: 315
Reply with quote  #2 
Hi
You could try something like
document.getElementById(buttonId).onclick = testFunction;

testFunction() {return false;}

__________________
If you want the job done right, hire a professional.
0
sourabh_en

Member
Registered:
Posts: 30
Reply with quote  #3 

how will i get the button id  and where should i write this code


__________________
Attitude is a little thing that makes a big difference.
websites: http://www.metastormhelp.info/
0
Pete

Senior Veteran
Registered:
Posts: 315
Reply with quote  #4 
The button ID usualy equals to the name you gave the button in the designer. Alternatively you get it by view the redered forms source.

You need to call this code on the client extensions for form load of the corresponding form of course

__________________
If you want the job done right, hire a professional.
0
Nappy

Avatar / Picture

Guru
Registered:
Posts: 1,087
Reply with quote  #5 
What is the exact problem here?

What is the button action set to for this button?

__________________
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.

PS that's for V6/7 for V9 the problem is V9 at the moment ;)
0
sourabh_en

Member
Registered:
Posts: 30
Reply with quote  #6 

In button action i need to validate the text boxes and if validation is done then call the serverside code .But now in my case jscript is not returning false and its running the server side code after clientside.


__________________
Attitude is a little thing that makes a big difference.
websites: http://www.metastormhelp.info/
0
Jerome

Avatar / Picture

Guru
Registered:
Posts: 5,507
Reply with quote  #7 
Quote:
Originally Posted by sourabh_en

In button action i need to validate the text boxes and if validation is done then call the serverside code .But now in my case jscript is not returning false and its running the server side code after clientside.

Returning false from a client script will not stop server execution. This only has an effect in the onsubmit() event.

Generally we cause the script to fail by assigning a nonexistent variable. It's a hack, but it works and I do not think it is likely to stop working. Something like:
Quote:
if (<everything is good>)
    return true;
else
    myVar = nonexistentvariable;


__________________
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
iannai

Member
Registered:
Posts: 33
Reply with quote  #8 
Sorry to bump an old post - we have used the "nonexistentvariable" hack for a while  and it's been fine, however at one client, it causes an IE popup error message:

Line: 135
Error: 'nonexistantvariable' is undefined

I have set the "show a notification about every script error" to NOT ticked in IE Options, but it makes no difference.

I wonder if anyone has any alternative methods of causing a client script to fail, thus preventing the serverside call?

Thanks
0
Jerome

Avatar / Picture

Guru
Registered:
Posts: 5,507
Reply with quote  #9 
Setting the event to null works IIRC. I cannot recall exactly how it is done, something like event=null;  ?

__________________
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
mohnshine

Avatar / Picture

Senior Veteran
Registered:
Posts: 270
Reply with quote  #10 
try throwing an error

if(ValidationFails) throw "Validation Error";


__________________
Your best practice does not conform with my best practice.
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:


Create your own forum with Website Toolbox!