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?
Această întrebare a fost marcată
1
Răspunde
6371
Vizualizări
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
Îți place discuția? Nu doar citi, alătură-te!
Creează-ți un cont astăzi pentru a beneficia de funcții exclusive și a interacționa cu minunata noastră comunitate!
Înscrie-te| Postări similare | Răspunsuri | Vizualizări | Activitate | |
|---|---|---|---|---|
|
|
2
mai 25
|
11136 | ||
|
|
3
mar. 24
|
6804 | ||
|
Website form field conditions
Rezolvat
|
|
1
ian. 21
|
4549 | |
|
|
1
iun. 18
|
4445 | ||
|
|
2
nov. 25
|
779 |