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?
คำถามนี้ถูกตั้งค่าสถานะ
1
ตอบกลับ
6994
มุมมอง
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
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อ| Related Posts | ตอบกลับ | มุมมอง | กิจกรรม | |
|---|---|---|---|---|
|
|
2
พ.ค. 25
|
11848 | ||
|
|
3
มี.ค. 24
|
7527 | ||
|
Website form field conditions
แก้ไขแล้ว
|
|
1
ม.ค. 21
|
5214 | |
|
|
1
มิ.ย. 18
|
4844 | ||
|
|
2
พ.ย. 25
|
1386 |