irigsoft Posted April 13, 2021 Share Posted April 13, 2021 Hi, I need to do some functionality to make my own add-on by the client. This add-on will replace onclick events on some buttons. Is this possible and is there any example I can see? I want to do something like that but on Client Side independent of server functions (like just extend some button OnClick): Just trying to insert functionality to the click event. It adds the function call to the start of the click event and then allows the default behaviour to occur, in this case a form submission: $(function() { $('[onclick*=WebForm_DoPostBackWithOptions]').click(function(event) { //call your custom functions here and then do nothing, the //default click event will still occur. If you don't want it to //propagate, call event.preventDefault(); var txt = this.onclick; txt = txt + ''; txt = txt.replace('WebForm_DoPostBackWithOptions','ml_DoPostBackWithOptions'); setTimeout(txt,0); //event.preventDefault(); //or //event.stopPropagation(); }); }); Link to comment Share on other sites More sharing options...
Sherzod Posted April 13, 2021 Share Posted April 13, 2021 Hello, Please explain your case in more detail. Link to comment Share on other sites More sharing options...
irigsoft Posted April 13, 2021 Author Share Posted April 13, 2021 I have some clients that want to use extended functionallity on some designs. I make different web designs with components and so on. For every button on this designs, I add on server side onClick event (VCL, no javascript). But some clients on this design want to change some buttons and extend functionallity of the buttons. I think for a way to do this on Client Side without changing VCL code in design. Is this possible ? Link to comment Share on other sites More sharing options...
Sherzod Posted April 13, 2021 Share Posted April 13, 2021 Using ClientEvents!? Link to comment Share on other sites More sharing options...
irigsoft Posted April 13, 2021 Author Share Posted April 13, 2021 2 minutes ago, Sherzod said: Using ClientEvents!? No, add-on on Client's web browser. Link to comment Share on other sites More sharing options...
irigsoft Posted April 13, 2021 Author Share Posted April 13, 2021 I think I can make add-ons with javascript and instal them on client's browser. This add-ons will work over loaded application, and dinamically replace or add some buttons functionallity on client side. Example of this: 1. Client load my web application on google chrome browser 2. Add-on will activate on this point. 3. Add-on will look for known buttons (add-on will search for buttons on design) , if is a found button will add some functionallity on button click, like : Standard "button.onclick" have ShowMessage ('Hi there') with one button OK Add-on will found this button and replace message with 'Hi, what we can do for You?' and show more buttons: OK, Close, Back Link to comment Share on other sites More sharing options...
Sherzod Posted April 13, 2021 Share Posted April 13, 2021 4 hours ago, irigsoft said: I think I can make add-ons with javascript and instal them on client's browser. This add-ons will work over loaded application, and dinamically replace or add some buttons functionallity on client side. Example of this: 1. Client load my web application on google chrome browser 2. Add-on will activate on this point. 3. Add-on will look for known buttons (add-on will search for buttons on design) , if is a found button will add some functionallity on button click, like : Standard "button.onclick" have ShowMessage ('Hi there') with one button OK Add-on will found this button and replace message with 'Hi, what we can do for You?' and show more buttons: OK, Close, Back I'm sorry, your case is not very clear to me. Link to comment Share on other sites More sharing options...
irigsoft Posted April 13, 2021 Author Share Posted April 13, 2021 Sorry, what I must explain? I don't know if there is a way to do what I want, I mean how to allow a client or other software developer only through javascript to expand my application without change my VCL code in delphi Link to comment Share on other sites More sharing options...
irigsoft Posted April 13, 2021 Author Share Posted April 13, 2021 something like that: 1. https://www.freecodecamp.org/news/how-to-make-a-cross-browser-extension-using-javascript-and-browser-apis-355c001cebba/ 2. https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension 3. https://developer.thunderbird.net/add-ons/mailextensions/hello-world-add-on 4. https://thoughtbot.com/blog/how-to-make-a-chrome-extension I want to use this idea to replace or expand the click of a button, is it possible? Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now