Genie Discord forum
![Author Avatar](https://cdn.discordapp.com/avatars/334615981471039490/a9ea5428995006278549a4967e4de999.png?size=512)
I am trying to figure out on how to make a widget take an input (For an instance, I want the text fields to take input for the backend code) Code is shown below:
#Handler Code
@appname StudLogin
@app begin
@in granted = false
@onchange granted begin
user_in=readline()
pass_in=readline()
users = CSV.File("Admin_Keys.txt")
found = false
for i in users
if user_in = i.user
found = true
if pass_in = i.pass
println("Logged in")
else
println("Invalid or Expired Credentials")
end
end
end
if found == false
println("Invalid or Expired Credentials")
end
end
end
#GUI widgets
function loginUI()
row(cell(class = "st-module", [
textfield(class = "q-my-md", "Username", :input, @on("keyup.enter", "process = true"))
textfield(class = "q-my-md", "Password", :input, hint = "Your DP Credentials", @on("keyup.enter", "process = true"))
btn(class="q-my-md", "Proceed", color = "primary", @click("granted =! granted"))
]))
end
@page("/", loginUI())
up()
![Author Avatar](https://cdn.discordapp.com/avatars/743412727464067154/bc30abeb49653e9978c0f7c90f4486a8.png?size=512)
you need to define the appropriate reactive variables for each component. That is
@in input = ""
@in process = false
@in granted = false
https://learn.genieframework.com/docs/reference/reactive-ui/reactivity#reactivity
![Author Avatar](https://cdn.discordapp.com/avatars/334615981471039490/a9ea5428995006278549a4967e4de999.png?size=512)
Can you show one example of how you use this @in process = false?
Updated code is shown below:
@app begin
@in userinput = ""
@in passinput = ""
@in process = false
@in granted = false
@onchange granted begin
user_in=userinput
pass_in=passinput
users = CSV.File("C:\\Users\\aayus\\Desktop\\GenieBuild\\GradeMasterGenie\\GradeMasterGenie\\Data\\Admin_Keys.csv")
found = false
for i in users #Beginning of linear search for username and password
if user_in == i.user #if username is in the text file then initiate another conditional check (Found = True)
found = true
if pass_in == i.pass #if password is found in the text file then redirect to admin student data entry
@in notifyme = false
@onchange notifyme begin
notify(model, msg)
println("Login Success")
end
else
@in notifypass = false
@onchange notifypass begin
notify(model, incpassmess)
end
println("Invalid or Expired Credentials") #Show message that credentials are either Invalid or Expired
end
end
end
if found == false
@in notifywruser = false
@onchange notifywruser begin
notify(model, incusermess)
end
println("Invalid or Expired Credentials")
end
end
end
#part 1 of code ```