I am attempting to run two JavaScript events when using onclick. The events are "mySqlDelete()" and "window.location.href='http://www.mydomain.com' ".
I have tried with using " mySqlDelete(); window.location.href='http://www.mydomain.com' " but the second event is not actioned although both parts work independently if I remove one event.
Any suggestions please.
Brian
Can I have two JavaScript onclick events in one input type button tag?
Forum rules
IMPORTANT NOTE!!
DO YOU HAVE A QUESTION OR PROBLEM AND WANT QUICK HELP?
THEN PLEASE SHARE A "DEMO" PROJECT.
PLEASE READ THE FORUM RULES BEFORE YOU POST:
http://www.wysiwygwebbuilder.com/forum/viewtopic.php?f=12&t=1901
MUST READ:
http://www.wysiwygwebbuilder.com/getting_started.html
WYSIWYG Web Builder FAQ
IMPORTANT NOTE!!
DO YOU HAVE A QUESTION OR PROBLEM AND WANT QUICK HELP?
THEN PLEASE SHARE A "DEMO" PROJECT.
PLEASE READ THE FORUM RULES BEFORE YOU POST:
http://www.wysiwygwebbuilder.com/forum/viewtopic.php?f=12&t=1901
MUST READ:
http://www.wysiwygwebbuilder.com/getting_started.html
WYSIWYG Web Builder FAQ
Re: Can I have two JavaScript onclick events in one input type button tag?
This should work because this is standard HTML functionality.
Maybe you have made a type error?
You can use the browser's debugger (F12) to see what is wrong.
Maybe you have made a type error?
You can use the browser's debugger (F12) to see what is wrong.
Re: Can I have two JavaScript onclick events in one input type button tag?
The browsers debugger is not showing any errors and I am sure that I had it working a couple of months ago when testing. I can't think of any changes that I have made that would affect things. Is there a workaround which would achieve what I am trying to do i.e. moving to another page after the database deletion?
Re: Can I have two JavaScript onclick events in one input type button tag?
If you need further assistance then please share a demo project so I can see what you have done.
Read this carefully before sharing:
http://www.wysiwygwebbuilder.com/forum/ ... 10&t=82134
Read this carefully before sharing:
http://www.wysiwygwebbuilder.com/forum/ ... 10&t=82134
Re: Can I have two JavaScript onclick events in one input type button tag?
As requested here is the wbs file stripped down.
https://www.stowaways.org/StowawaysDeletePage.wbs
The project does include the SQL connector extension in the opening page as it is an integral part.
The purpose of the page is twofold. First to delete an entry in a database and secondly to mail an advice to the sender and the webmaster. The second part is achieved by redirecting to the page "delete_entry_mailing", which contains the standard form mailer, and the button on that page is automatically clicked via a script.
As previously stated , the two functions for the onclick event in the first page work when used separately but do not redirect to the second page when combined.
Have I over-complicated the process or is there another way?
https://www.stowaways.org/StowawaysDeletePage.wbs
The project does include the SQL connector extension in the opening page as it is an integral part.
The purpose of the page is twofold. First to delete an entry in a database and secondly to mail an advice to the sender and the webmaster. The second part is achieved by redirecting to the page "delete_entry_mailing", which contains the standard form mailer, and the button on that page is automatically clicked via a script.
As previously stated , the two functions for the onclick event in the first page work when used separately but do not redirect to the second page when combined.
Have I over-complicated the process or is there another way?
Re: Can I have two JavaScript onclick events in one input type button tag?
The reason why this does not work is because mySqlDelete() reloads the page, so in this case all code after the function is ignored by the browser.
Re: Can I have two JavaScript onclick events in one input type button tag?
If that is the case, is there a way I could arrange the redirect after the page has been reloaded?
Re: Can I have two JavaScript onclick events in one input type button tag?
There is no standard solution for this becuase you will have to keep track of what the last action was (with cookies or webstorage) before the page gets reloaded. This can only be done with custom code.
Re: Can I have two JavaScript onclick events in one input type button tag?
Thanks Pablo, at least I know why the onclick function was not working. I will try to think of another way or just abandon the emails about the deletion.