# Html input from table with images

**URL:** https://discourse.nodered.org/t/html-input-from-table-with-images/52308
**Category:** General
**Created:** [16 October 2021 19:54 UTC](https://discourse.nodered.org/t/html-input-from-table-with-images/52308 "2021-10-16T19:54:52Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![RogierQ](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rogierq/32/3211_2.png) [@RogierQ](https://discourse.nodered.org/u/RogierQ)
#### Post date: [16 October 2021 19:54 UTC](https://discourse.nodered.org/t/html-input-from-table-with-images/52308/1 "2021-10-16T19:54:52Z")

</div>

Hi!

Trying to create a html page with iamges that sends a payload to nr.  
Found some examples but cannot get it to work that it sends the id as a payload.  
Can somebody help me to tell me what i do wrong?  
My flow is below

```auto
[{"id":"b11293a5f92bf98a","type":"ui_template","z":"a9c11d25de2e5544","group":"61db9c3f37fc1036","name":"","order":1,"width":"6","height":"7","format":"<!doctype html>\n<html>\n<head>\n<meta charset=\"UTF-8\">\n<title>Test</title>\n</head>\n\n<body>\n<table width=\"95%\" border=\"0\">\n <tbody>\n <tr>\n <td><img src=\"image.jpg\" width=\"65\" height=\"65\" alt=\"\" ng-click=\"sendMsg()\" id =\"99\"/></td>\n <td><img src=\"image.jpg\" width=\"65\" height=\"65\" alt=\"\" ng-click=\"sendMsg()\"/></td>\n </tr>\n <tr>\n <td><img src=\"image.jpg\" width=\"65\" height=\"65\" alt=\"\" ng-click=\"sendMsg()\"/></td>\n <td><img src=\"image.jpg\" width=\"65\" height=\"65\" alt=\"\" ng-click=\"sendMsg()\"/></td>\n </tr>\n </tbody>\n</table>\n\n\t<script>\n (function(scope) {\n scope.sendMsg = function() {\n scope.send({ payload: { button: Number(scope)}})\n}\n\n})(scope);\n</script>\n</body>\n</html>\n","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","className":"","x":480,"y":240,"wires":[["75d8d7a42c1072d4"]]},{"id":"75d8d7a42c1072d4","type":"debug","z":"a9c11d25de2e5544","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":670,"y":240,"wires":[]},{"id":"61db9c3f37fc1036","type":"ui_group","name":"test","tab":"74b1d602a9d252c0","order":1,"disp":false,"width":"12","collapse":false,"className":""},{"id":"74b1d602a9d252c0","type":"ui_tab","name":"Bom","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

### Author: ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)
#### Post date: [16 October 2021 20:31 UTC](https://discourse.nodered.org/t/html-input-from-table-with-images/52308/2 "2021-10-16T20:31:29Z")

</div>

A quick search on the internets on how to pass event with Angular's ng-click  
`ng-click="sendMsg($event)"`

then in your function :

```auto
 scope.sendMsg = function(event) {
        console.log("Triggered", event)
        scope.send({ payload: { button: Number(event.target.id)}})
}

```

**Flow :**

```auto
[{"id":"b11293a5f92bf98a","type":"ui_template","z":"5847b7aa62131d37","group":"61db9c3f37fc1036","name":"","order":1,"width":"6","height":"7","format":"<!doctype html>\n<html>\n<head>\n<meta charset=\"UTF-8\">\n<title>Test</title>\n</head>\n\n<body>\n<table width=\"95%\" border=\"0\">\n <tbody>\n <tr>\n <td><img src=\"image.jpg\" width=\"65\" height=\"65\" alt=\"\" ng-click=\"sendMsg($event)\" id =\"99\"/></td>\n <td><img src=\"image.jpg\" width=\"65\" height=\"65\" alt=\"\" ng-click=\"sendMsg($event)\"/></td>\n </tr>\n <tr>\n <td><img src=\"image.jpg\" width=\"65\" height=\"65\" alt=\"\" ng-click=\"sendMsg($event)\"/></td>\n <td><img src=\"image.jpg\" width=\"65\" height=\"65\" alt=\"\" ng-click=\"sendMsg($event)\"/></td>\n </tr>\n </tbody>\n</table>\n\n\t<script>\n (function(scope) {\n scope.sendMsg = function(event) {\n console.log(\"Triggered\", event)\n scope.send({ payload: { button: Number(event.target.id)}})\n}\n\n})(scope);\n</script>\n</body>\n</html>\n","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","className":"","x":400,"y":1240,"wires":[["75d8d7a42c1072d4"]]},{"id":"75d8d7a42c1072d4","type":"debug","z":"5847b7aa62131d37","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":590,"y":1240,"wires":[]},{"id":"61db9c3f37fc1036","type":"ui_group","name":"test","tab":"74b1d602a9d252c0","order":1,"disp":false,"width":"12","collapse":false,"className":""},{"id":"74b1d602a9d252c0","type":"ui_tab","name":"Bom","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

ps. you'll need id's for the rest of the images

---

<div class="post-metadata">

### Author: ![RogierQ](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rogierq/32/3211_2.png) [@RogierQ](https://discourse.nodered.org/u/RogierQ)
#### Post date: [16 October 2021 20:37 UTC](https://discourse.nodered.org/t/html-input-from-table-with-images/52308/3 "2021-10-16T20:37:15Z")

</div>

Thanks! for your reply!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [15 December 2021 20:37 UTC](https://discourse.nodered.org/t/html-input-from-table-with-images/52308/4 "2021-12-15T20:37:28Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
