Send Backspace - Forum

Forum Navigation
You need to log in to create posts and topics.

Send Backspace

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.

@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:
  • You need to login to have access to uploads.

Perfect! This will do it I am sure. Could not find anything on searching.

Cheers again.

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 ?

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.