# Perspective Text Field Numeric Keypad

**URL:** <https://forum.inductiveautomation.com/t/perspective-text-field-numeric-keypad/71229>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [March 17, 2023, 1:59pm UTC](https://forum.inductiveautomation.com/t/perspective-text-field-numeric-keypad/71229 "2023-03-17T13:59:21Z")\
**Posts on this page:** 14\
**Page:** 3

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [March 23, 2024, 10:47am UTC](https://forum.inductiveautomation.com/t/perspective-text-field-numeric-keypad/71229/41 "2024-03-23T10:47:12Z")

</div>

The flex repeater passes in a "secret" **index** parameter. The index number is the array number.  
 ![Repeater index](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/3/9311f06f08db8f4781f6cd41adabf9cc654b8da1.png)  
_Figure 1. The instance index._

On the repeated view add the `index` parameter. I've set it to -1 so I know if it is the test value or the real index value.

![Subview index](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/3/835390cbfd62fdb793d18868ebe5b461d3d1d284.png)  
_Figure 2. Add the index parameter on the subview._

Now,

1. Pass the index parameter to your keypad popup.
2. Include the index number in the keypad sendMessage.
3. On the subview message handler check the index number.

 ![Message handler index](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/f/7f79b77d429ad50184b197962462893b25a5e8c6.png)

_Figure 3. The subview message handler._

I might not have the scope set correctly in Figure 3.

It's in the manual but would be hard to find if you didn't know what to look for. [Perspective - Flex Repeater | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/appendix/components/perspective-components/perspective-embedding-palette/perspective-flex-repeater#description)

Tip 😜:  
Message: ![email](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/f/af2279c094d8d248f059ab861a54c1cfe3b3637f.png) Massage: ![Massage.jpg](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/f/6f209fa66f662ab81feff6406af176b9c968762e.png)

---

<div class="post-metadata">

**Author:** ![Abhijit\_Jagtap1](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@Abhijit\_Jagtap1](https://forum.inductiveautomation.com/u/Abhijit_Jagtap1)\
**Post date:** [March 23, 2024, 12:01pm UTC](https://forum.inductiveautomation.com/t/perspective-text-field-numeric-keypad/71229/42 "2024-03-23T12:01:28Z")

</div>

Hi  
I am traying this way but now no value display.  
I can't understand.  
Can you give me brief example?  
Please share your valuable feedback

I have added Index in PARMS of

 ![Image3](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/6/967855866bca86e9bc156563e8051ef001e5a292.png)  
 ![Image2](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/9/691d51f868740335d8295b9f3ae2a7d66e1ff906.png)  
 ![Image1](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/2/a24f607159f838ac540fe06836ef9323f67d410b.png)

---

<div class="post-metadata">

**Author:** ![Abhijit\_Jagtap1](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@Abhijit\_Jagtap1](https://forum.inductiveautomation.com/u/Abhijit_Jagtap1)\
**Post date:** [March 23, 2024, 12:03pm UTC](https://forum.inductiveautomation.com/t/perspective-text-field-numeric-keypad/71229/43 "2024-03-23T12:03:19Z")

</div>

![MicrosoftTeams-image (15)](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/f/9fba316a11956c26d86c01ca97b89b5e9b659bcf.png)  
 ![MicrosoftTeams-image (14)](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/d/8d051efc92c9bedb789b1f895c71eb03714eaaca.png)  
 ![MicrosoftTeams-image (13)](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/e/de1058f7266e1c53b1bcfc841374f9e1c9ece1d1.png)

---

<div class="post-metadata">

**Author:** ![Abhijit\_Jagtap1](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@Abhijit\_Jagtap1](https://forum.inductiveautomation.com/u/Abhijit_Jagtap1)\
**Post date:** [March 23, 2024, 12:04pm UTC](https://forum.inductiveautomation.com/t/perspective-text-field-numeric-keypad/71229/44 "2024-03-23T12:04:23Z")

</div>

Please refer above Images.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [March 23, 2024, 12:26pm UTC](https://forum.inductiveautomation.com/t/perspective-text-field-numeric-keypad/71229/45 "2024-03-23T12:26:34Z")

</div>

- You posted the images from post #40 again in post #42. Please don't do that unless you are including new information.
- There is a pencil link below each of your posts so you can edit it. You don't need to write a new post to say, "Please refer above images."

* * *

![Incorrect index parameters](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/5/0526cb710ea41db08bc1374e09806a5588fe4d48.png)

_Figure 4. Delete all of these._

The _index_ parameter is supplied automatically.

It looks like `label = index + 1` so you can calculate that on the view.  
 ![Subview index](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/d/fded106cd29b8f79016b6bcc3a3afe50c7326053.png)  
_Figure 5. Calculating the label number from the index parameter._

![Message handler missing code](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/a/da5691e36bbf068443033ed80980993a95537086.png)  
_Figure 6. You have no code for when the index is correct!_

---

<div class="post-metadata">

**Author:** ![Abhijit\_Jagtap1](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@Abhijit\_Jagtap1](https://forum.inductiveautomation.com/u/Abhijit_Jagtap1)\
**Post date:** [March 25, 2024, 11:16am UTC](https://forum.inductiveautomation.com/t/perspective-text-field-numeric-keypad/71229/46 "2024-03-25T11:16:58Z")

</div>

Refre to fig 6.  
Can you give me some script.  
I am new in ignition.  
I dont understand what code write in in massage handler.

---

<div class="post-metadata">

**Author:** ![Abhijit\_Jagtap1](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@Abhijit\_Jagtap1](https://forum.inductiveautomation.com/u/Abhijit_Jagtap1)\
**Post date:** [March 25, 2024, 11:19am UTC](https://forum.inductiveautomation.com/t/perspective-text-field-numeric-keypad/71229/47 "2024-03-25T11:19:28Z")

</div>

Can i replace owner with index in 1st image that i send you fast

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [March 25, 2024, 11:59am UTC](https://forum.inductiveautomation.com/t/perspective-text-field-numeric-keypad/71229/48 "2024-03-25T11:59:47Z")

</div>

Have you read the documentation and watched the videos on the page below?

> **[Component Message Handlers | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/ignition-modules/perspective/scripting-in-perspective/component-message-handlers)**
>
> In Perspective, Component Message Handlers are the preferred way to pass parameters between components or Views. Doing this involves the system.perspective.sendMessage function. There are typically two steps involved:

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [March 25, 2024, 3:24pm UTC](https://forum.inductiveautomation.com/t/perspective-text-field-numeric-keypad/71229/49 "2024-03-25T15:24:27Z")

</div>

The easier solution is something someone else mentioned that should fix it (I'll update my Exchange submission with this update/fix as well, but for now, make the following changes:

Add a custom value property under the existing keypad custom property named "ownerId" (should look like this):  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/b/1b761a7a65ba37214ee3ebefebf7b9bcabf1e7e3.png)

Change the onMouseDown event script on the numeric entry to:

```auto
	self.custom.keypad.ownerId = str(system.date.toMillis(system.date.now()))
	owner = self.custom.keypad.ownerId
	popParams = {'owner': owner, 'min': self.props.inputBounds.minimum, 'max': self.props.inputBounds.maximum, 'oldValue': self.props.value, 'units': self.custom.keypad.units}
	posit = None if self.custom.keypad.centerScreen else {'left': event.clientX, 'top': event.clientY}
	system.perspective.openPopup('keypadPopup-' + owner, 'Exchange/Keypad/Numeric Popup', title=self.custom.keypad.title, params=popParams, position=posit, showCloseIcon=True, draggable=True, resizable=True, viewportBound=True, modal=True, overlayDismiss=True)

```

Change the keypadReturn message handler to use this instead:

```auto
	if self.custom.keypad.ownerId == payload['owner']:
		self.props.value = float(payload['value'])

```

Similar changes can be made to the other keypad popups, but this should hopefully solve your issue.

---

<div class="post-metadata">

**Author:** ![Abhijit\_Jagtap1](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@Abhijit\_Jagtap1](https://forum.inductiveautomation.com/u/Abhijit_Jagtap1)\
**Post date:** [March 26, 2024, 5:33am UTC](https://forum.inductiveautomation.com/t/perspective-text-field-numeric-keypad/71229/50 "2024-03-26T05:33:19Z")

</div>

Hi Michael & Transistor,  
Thank you Very much. My issue is solved.

---

<div class="post-metadata">

**Author:** ![DinMun](https://avatars.discourse-cdn.com/v4/letter/d/ee59a6/32.png) [@DinMun](https://forum.inductiveautomation.com/u/DinMun)\
**Post date:** [May 21, 2024, 6:22pm UTC](https://forum.inductiveautomation.com/t/perspective-text-field-numeric-keypad/71229/51 "2024-05-21T18:22:27Z")

</div>

Hi,

I've followed your guide and I've got to the point where the numpad is popping up but, after pressing Enter, my new value doesn't register.

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [May 21, 2024, 6:43pm UTC](https://forum.inductiveautomation.com/t/perspective-text-field-numeric-keypad/71229/52 "2024-05-21T18:43:30Z")

</div>

Most likely, you're missing something. Check everything in my example view (Test Keypads) especially the mouseDown event and the keypadReturn message handler script. The event passes the owner to the keypad so that it can properly return the value. Then the message handler script sets the value of the component to the value returned from the keypad. If you're missing either one, it won't work.

---

<div class="post-metadata">

**Author:** ![DinMun](https://avatars.discourse-cdn.com/v4/letter/d/ee59a6/32.png) [@DinMun](https://forum.inductiveautomation.com/u/DinMun)\
**Post date:** [June 25, 2024, 4:00pm UTC](https://forum.inductiveautomation.com/t/perspective-text-field-numeric-keypad/71229/53 "2024-06-25T16:00:17Z")

</div>

So the issue turned out to be spacing in the script.

When I first copied your script from your post above, it looked like this:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/8/f8899903fa80690206b3c6707962d73ab6d20f87.png)

After fixing the spacing, it worked:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/3/73af9e96bca52f34bbe560fd4997fd72e320c701.png)

---

<div class="post-metadata">

**Author:** ![petr.sasin](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@petr.sasin](https://forum.inductiveautomation.com/u/petr.sasin)\
**Post date:** [June 4, 2025, 3:25pm UTC](https://forum.inductiveautomation.com/t/perspective-text-field-numeric-keypad/71229/54 "2025-06-04T15:25:58Z")

</div>

Thanks. Works like a charm.

[Previous page](https://forum.inductiveautomation.com/t/perspective-text-field-numeric-keypad/71229.md?page=2)
