You are not logged in.

#1 2021-06-13 14:01:57

Rahul
Member
Registered: 2019-11-27
Posts: 39

Custom Button Functionality

I am trying to build custom functionality through the port using custom button feature. Wanted to understand if there is a possibility to pass variables and return a response (say JSON) from service.

Kindly let me know your thoughts, possibly you can share a sample code/steps.

thanks in anticipation!

Last edited by Rahul (2021-06-13 14:02:28)

Offline

#2 2021-06-14 04:42:20

Shahin
Administrator
Registered: 2016-02-17
Posts: 3,546

Re: Custom Button Functionality

Sure you can use [[NetReturn ]] to do it.
https://docs.nanodlp.com/manual/code/

Offline

#3 2021-06-14 12:53:47

Rahul
Member
Registered: 2019-11-27
Posts: 39

Re: Custom Button Functionality

I just tried to add test functionality to redirect to /plates. but receiving an error:: "Net Request Failed Get '/plates': unsupported protocol scheme ''

here is the content from my buttons.json:
{
        "ID": 0,
        "Name": "Test",
        "Position": "/",
        "Condition": "",
        "Color": "btn btn-info",
        "Gcode": "[[NetReturn /plates]]",
        "HTML": "\u003clabel\u003etest redirect\u003c/label\u003e",
        "ConfirmText": "testing redirect"
    }

My actual requirement is to execute the external script passing some values and return the response back to the page.
For Ex: Adding current time to the UI, also allowing the user to modify time and change the timezone.

kindly advise.

Offline

#4 2021-06-17 02:08:40

Shahin
Administrator
Registered: 2016-02-17
Posts: 3,546

Re: Custom Button Functionality

It must be full URL. For example http://127.0.0.1/plates

Offline

Board footer

Powered by FluxBB