Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
5056 Vizualizări

I added custom button inside a website form but after clicking it always calls website/form controller and says 'Bad Request'. How I make it call only JS function that I added without going to controller?

Imagine profil
Abandonează
Cel mai bun răspuns

Hi,

In .xml

<button name="my_button" type="object" string="My Button" on_click="my_js_function"/>

js:-

function my_js_function() {
// code for your JavaScript function goes here
}
// add event handler for button click event
document.getElementById('my_button').addEventListener('click', function(event) {
// call JavaScript function
my_js_function();
// prevent default action of button
event.preventDefault();
});

Regards

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
mai 25
9751
3
mar. 24
5409
1
ian. 21
3431
1
iun. 18
3415
0
ian. 25
1162