Quote from Chillcoder on September 8, 2021, 8:06 amHi.
Visual Neo Web question.
I have a numeric field that the user clicks into and gets a numeric keyboard fine. In order to type a value they have to first clear the default 0 in the field with a backspace.
Is it possible to clear the field as soon as they click into it as if they have pressed the backspace.
I have tried all the usual setvar events and nothing clears the field of the default 0.
I need the default 0 in the field as its a maths field. I know I could code around that and apply the zero if no entry but trying to do it simply as I have about 20 fields that will need the same thing.
Thanks in advance.
Hi.
Visual Neo Web question.
I have a numeric field that the user clicks into and gets a numeric keyboard fine. In order to type a value they have to first clear the default 0 in the field with a backspace.
Is it possible to clear the field as soon as they click into it as if they have pressed the backspace.
I have tried all the usual setvar events and nothing clears the field of the default 0.
I need the default 0 in the field as its a maths field. I know I could code around that and apply the zero if no entry but trying to do it simply as I have about 20 fields that will need the same thing.
Thanks in advance.

Quote from luishp on September 8, 2021, 1:01 pm@jason-roberts I'm not sure if I'm understanding you well. Anyway please take a look at my attached sample.
I have added this line to Page-enter Code tab to detect a click event:OnMouseEvent "NumericInput1" "click" "noValue"Then I have created a new subroutine "noValue" with this code (note that there must be a parameter to get information about the numeric input that has been clicked):
SetVar [data] [objectData] if [data.currentTarget.value] == "0" SetVar [data.currentTarget.value] "" EndIfThis will empty the value in case it has a zero value.
I need the default 0 in the field as its a maths field. I know I could code around that and apply the zero if no entry but trying to do it simply as I have about 20 fields that will need the same thing.
You can do it very easily with a loop.
I hope it helps.Regards.
@jason-roberts I'm not sure if I'm understanding you well. Anyway please take a look at my attached sample.
I have added this line to Page-enter Code tab to detect a click event:
OnMouseEvent "NumericInput1" "click" "noValue"
Then I have created a new subroutine "noValue" with this code (note that there must be a parameter to get information about the numeric input that has been clicked):
SetVar [data] [objectData] if [data.currentTarget.value] == "0" SetVar [data.currentTarget.value] "" EndIf
This will empty the value in case it has a zero value.
I need the default 0 in the field as its a maths field. I know I could code around that and apply the zero if no entry but trying to do it simply as I have about 20 fields that will need the same thing.
You can do it very easily with a loop.
I hope it helps.
Regards.
Uploaded files:Quote from Chillcoder on September 8, 2021, 1:15 pmPerfect! This will do it I am sure. Could not find anything on searching.
Cheers again.
Perfect! This will do it I am sure. Could not find anything on searching.
Cheers again.

Quote from Phil78 on September 9, 2021, 4:21 pmHi Luis,
How do we know which subroutine receive an implicit parameter, unless all subroutines receive an object parameter ?
How do we know the word currentTarget ? Is there other words like this defined in the object ?
Hi Luis,
How do we know which subroutine receive an implicit parameter, unless all subroutines receive an object parameter ?
How do we know the word currentTarget ? Is there other words like this defined in the object ?

Quote from luishp on September 10, 2021, 7:12 amHi @phil78
How do we know which subroutine receive an implicit parameter
All events related commands send information in JSON format of the affected object to the callback subroutine. You define the subroutine and decide if you need or not to process that information.
How do we know the word currentTarget ? Is there other words like this defined in the object ?
That's a good question. Just use Consolelog to print in the console all the available data sent by the event to the subroutine. I have to do it everytime as I never remember all those names :)
Regards.
Hi @phil78
How do we know which subroutine receive an implicit parameter
All events related commands send information in JSON format of the affected object to the callback subroutine. You define the subroutine and decide if you need or not to process that information.
How do we know the word currentTarget ? Is there other words like this defined in the object ?
That's a good question. Just use Consolelog to print in the console all the available data sent by the event to the subroutine. I have to do it everytime as I never remember all those names :)
Regards.