POS link between Js and HTML

Hi All,
I tried putting a custom button on pos page. (pos.html)
Now i need to call a function on click of the button ( i guess the file which comes in picture is pos.js)

Now i m super confused where to put that function and how to get other selected parameters like customer or anything…
I tried putting the function inside
“erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
function_name : function(){}
})”

-------- this didnt work.
I went through so many blogs . U guys have suggested =>
frappe.ui.form.on(“Doctype Name”, “field_name”,
function(frm) {}
});

But where shld i put this code… ???

For temporary solution I m using jquery n i m ashamed of myself…
Do u guys have some js documentation… or code structure relation documentation …
as i found directory structure bit different from frappe normal Library Mgt app…
or i m tooooo new to frappe… :frowning:
Do help me if possible as I m stuck for 2 days…

That is the correct place to put your custom function. Just read the code in pos.js and see how click events are attached to buttons.

@netchampfaris … thank u so much atleast for replying…

PFA Screenshots of my code and the error i received in console…
I have the code running on click of generate button … and i m right now just trying to alert something on that click…

do tell me where i m wrong…
thnxxx

I m stupid. My issue got resolved .
There is a parent function called bind_events … i wrote my function over there taking the reference of given code. thnzzz

1 Like