Blink.jl - Apply form data to a julia function

#1

Hi everyone,

I made a function in julia which performs some routinary tasks automatically and it works just fine, but now I’m trying to build a really simple GUI (using Blink.jl) consisting only of a form for my collegues to introduce some parameters for the function. My problem is that I don’t know yet how to get the values provided in the form to be passed to my julia function. This is what I’ve got so far (the javascript section is left blank because I don’t know what to do and println is going to be substituted with the function I created:

using Blink

w = Window(async = false)   # Crea una ventana tipo html
handle(w, "mensaje") do arg
  cliente = arg[1] ; fecha_actual = Date(arg[2], arg[3], arg[4])
  fecha_anterior = Date(arg[5],arg[6],arg[7]) ; SMG_actual = arg[8]
  SMG_anterior = arg[9]
  println([cliente, fecha_actual,fecha_anterior,SMG_actual,SMG_anterior])
end
#body!(w, """<button onclick='Blink.msg("mensaje", [1,2,3,4,5])'>go</button>""")

body!(w,"""
<html>
    <head>
        <title>Verificación de información</title>
        <p><center>Verificación de información</center></p><br>
    </head>
    <body>
        <form>
            Introduzca el nombre del cliente:
            <input type="text" id="nombre_cliente" name="client_name"/><br><br>
            Fecha anterior: (YYYY,MM,DD):
            <input type="number" id="año_anterior" name="year_prev"/>&ensp;
            <input type="number" id="mes_anterior" name="month_prev"/>&ensp;
            <input type="number" id="dia_anterior" name="day_prev"/><br><br>
            Fecha actual (YYY,MM,DD):
            <input type="number" id="año_actual" name="year_curr"/>&ensp;
            <input type="number" id="mes_actual" name="month_curr"/>&ensp;
            <input type="number" id="dia_actual" name="day_curr"/><br><br>
            Introduzca el valor para la UMA/SMG del año anterior:
            <input type="number" step="0.01" id="SMG_anterior" name="SMG_curr"/><br><br>
            Introduzca el valor para la UMA/SMG del año actual:
            <input type="number" step="0.01" id="SMG_actual" name="SMG_curr"/><br><br>
            <script>


              
            </script>
            <center><button onclick='Blink.msg("mensaje", "[client,curr_year,curr__month,curr_day,prev_year,prev_month,prev_day,curr_SMG,prev_SMG]")'>aceptar</button></center>
        <br>
        <br>
    </body>
</html>  """,async = false)

Thank you in advance!

0 Likes