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
회신
6991
화면
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
| 관련 게시물 | 답글 | 화면 | 활동 | |
|---|---|---|---|---|
|
|
2
5월 25
|
11847 | ||
|
|
3
3월 24
|
7527 | ||
|
|
1
1월 21
|
5213 | ||
|
|
1
6월 18
|
4839 | ||
|
|
2
11월 25
|
1385 |