HTML entities click event triggering multiple times

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

HTML entities click event triggering multiple times

#1

Postby Segi » Mon Jun 16, 2014 9:48 pm

I have a form that displays data in a table.

The table has 2 buttons directly above it.

The first is an Edit button that when clicked on sets displayOnly to false on the table so that the user can edit the table and changes the button text to Save. Clicking on Save sets displayOnly to true again and changes the button text back to Edit.

The other button is a schedule button which is tied a HTML Entities->jQuery click event. The code in the click event is as follows:

Code: Select all

var sessionid=$eb.getField("SESSIONID").getValue();

var realname=$eb.getField("REALNAME").getValue();

var jobwindow=window.open('ufsmain?formid=SCHEDULE&Realname=' + realname + '&SessionID=' + sessionid,'_blank','fullscreen=yes');

jobwindow.resizeTo(screen.availWidth, screen.availHeight);

return false;
[/code]

As you can see from this code, all I am doing is displaying another eBase form in a popup window.

When the user clicks on the Schedule, the window pops up once as expected.

Here is the problem.

When the user clicks on the Edit button then click on the Schedule button or the user clicks on Edit->Save then clicks on the schedule button the jQuery click event is triggered multiple times causing the popup window to open multiple times (the exact # of times varies). I have verified that my jQuery code in itself is not the issue by replacing all of the code with a sample javaScript alert which displays the alert multiple times.

I have also seen this behavior on another form so I do not believe that it is something specific to my jQuery code. It appears as though some kind of bug is causing eBase to trigger multiple click events on the button.

I can replicate this bug every time and it appears to be jQuery specific.

If I move the exact same code to an HTML onclick event this behavior does NOT occur.
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Tue Jun 17, 2014 7:51 am

I don't know what's causing your problem, it doesn't sound familiar. Ebase specifically unbinds and rebinds each event handler on each interaction with the server, so it shouldn't be possible for this accumulation of events to occur. Some questions/suggestions:

Which version of Ebase are you using?
Check that the id or class of the jQuery button is unique on this page and is not also used by another control on the same page.
Check for Javascript errors during execution - something might be interfering with the Ebase unbind/rebind code.
Do you have any additional Javascript code on the page that might be interfering?
Does the behaviour change if you activate/deactivate Ajax (Form properties)?
Are repeaters involved?

Regards
Jon
0 x

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

#3

Postby Segi » Tue Jun 17, 2014 2:08 pm

Jon,

1. 4.5.1
2. The id is unique
3. There are no errors in the javascript console
4. No
5. No
6. On this particular form yes but I have seen this exact same behavior on 2 other forms that do not have a repeater.
0 x

Dave
Ebase Staff
Posts: 89
Joined: Mon Sep 10, 2007 11:48 am

#4

Postby Dave » Tue Jun 17, 2014 8:46 pm

Hi Segi - I tried this exactly as you described and it worked fine, i.e. didn't get multiple windows up no matter what I clicked. Nothing else in my form of course apart from what you said. This was on V452 latest btw. Want me to send you an export?

Dave
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#5

Postby Jon » Wed Jun 18, 2014 7:13 am

Segi,

Is it possible for us to have a look at this? Is the form available on a public site? If not, could you send an export to support@ebasetech.com - if possible, the form exported should be something we can run so we can reproduce your problem.

Regards
Jon
0 x

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

#6

Postby Segi » Wed Jun 18, 2014 8:46 pm

Jon,

It is not publicly available and I cannot make it available since it refers to a local php script which I cannot provide but I would be happy to do a gotomeeting session to show you this behavior.
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#7

Postby Jon » Thu Jun 19, 2014 7:53 am

OK, let's do a gotomeeting session though timing is a bit difficult. Could you do 14:00 or 15:00 UK time (06:00 or 07:00 for you) today (Thursday or tomorrow)? Do you want to set up the session or should we do it?

Regards
Jon
0 x

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

#8

Postby Segi » Thu Jun 19, 2014 5:16 pm

Jon,

The earliest that I can do it is 8AM my time. I am available either tomorrow or Monday morning.

Please set up the gotomeeting session and email me the details.

Thanks,

Segi
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#9

Postby Jon » Thu Jun 26, 2014 2:08 pm

This problem was caused by a JSP (defined as part of the form) that contained a <script> tag to load the jQuery javascript. The form was also loading the same jQuery Javascript file. Removing this tag from the JSP fixed the problem.

Additional notes: when a form is using Ajax (or when the client API is used i.e. $eb..) and a form page contains JSPs, Ebase will always refresh the JSP content when the page display is refreshed - it does this because it has no way of knowing whether something has been changed that might affect the JSP. To address this problem, an additional option has been added in V4.5.2 to the configuration of JSPs that allows a JSP to be configured as static. When this option is set, Jsp content is generated when a page is first displayed and is not refreshed for each subsequent Ajax interaction.
0 x


Who is online

Users browsing this forum: No registered users and 13 guests