Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
4971 Widoki

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?

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
maj 25
9703
3
mar 24
5325
1
sty 21
3384
1
cze 18
3364
0
sty 25
1101