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?
Bu soru işaretlendi
1
Cevapla
6989
Görünümler
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
Tartışma hoşunuza mı gidiyor? Sadece okumakla kalmayın, katılın!
Özel özelliklerden yararlanmak ve harika topluluğumuzla etkileşime geçmek için bugün bir hesap oluşturun!
Üye Ol| İlgili Gönderiler | Cevaplar | Görünümler | Aktivite | |
|---|---|---|---|---|
|
|
2
May 25
|
11846 | ||
|
|
3
Mar 24
|
7527 | ||
|
Website form field conditions
Çözüldü
|
|
1
Oca 21
|
5213 | |
|
|
1
Haz 18
|
4839 | ||
|
|
2
Kas 25
|
1385 |