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?
Pertanyaan ini telah diberikan tanda
1
Balas
6212
Tampilan
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
Menikmati diskusi? Jangan hanya membaca, ikuti!
Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!
Daftar| Post Terkait | Replies | Tampilan | Aktivitas | |
|---|---|---|---|---|
|
|
2
Mei 25
|
10964 | ||
|
|
3
Mar 24
|
6684 | ||
|
Website form field conditions
Diselesaikan
|
|
1
Jan 21
|
4475 | |
|
|
1
Jun 18
|
4346 | ||
|
|
2
Nov 25
|
674 |