question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

href as action does not carry over parameters

See original GitHub issue

I would like to hand over a parameter (id) from one view to the next when clicking on a button like this: Both version however don’t work:

{
  "type": "button",
  "style": {
  "height": "20"
  },
  "url": "file://image.png",
  "action": {
  "type": "$href",
  "options": {
  "url": "file://some-local-json.json"
   },
   "id": "1234567"
}
{
  "type": "button",
  "style": {
  "height": "20"
  },
  "url": "file://image.png",
  "action": {
  "type": "$href",
  "options": {
  "url": "file://some-local-json.json"
  "id": "1234567"
   } 
}

The version that does work is this one, which is however not usable in my setup, since I would also like to implement the $ok two-way communication:

{
"type": "label",
"text": "Open view",
 "href": {
   "url": "file://some-local-json.json",
   "options": {
   "id": "1234567"
    }
  }
}

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
darenrcommented, Aug 20, 2018

@clsource I’m not sure what the blog post you mentioned has to do with this? I also don’t really understand the point about sandboxing where views all share a common global dictionary, that’s not really how sandboxing works. But regardless you originally closed this issue suggestion people not use the options and instead put their parameters into the $global dictionary, and I responded that that’s not a very good user experience. Now you’re suggesting that we use the parameter passing mechanism that mexophantes wanted all along. Letting two views manipulate a global variable is a very bad suggestion, it’s just bad software engineering. The right way is to follow the traditional stack method, which is what $href does, pass by value (not reference), then return by value (with $ok). The problem is that mexophantes says this does not work with href actions, but does with $href. I haven’t tried this to know since I’m passing values around using only $href, but at least now I think we’re all in agreement that we shouldn’t be communicating between views using $global variables.

1reaction
clsourcecommented, Jul 30, 2018

Please read this

https://medium.com/@gliechtenstein/native-mobile-view-as-microservice-fd24ea62defa

Here is an example of using $href with params

{
  "type": "$href",
  "options": {
    "url": "https://jasonbase.com/things/3fj.json",
    "options": {
      "firstName": "Bart",
      "lastName": "Simpson"
    }
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

adding a parameter to href link - html - Stack Overflow
SchoolId is a parameter that I need to add, I have tried .ToString() and it does not work, any help? The parameter is...
Read more >
Window.location.href pass a wrong parameter to the controller
I know this is something simple, but I've never run across this before. I have the route. routes.MapRoute(" ...
Read more >
Action link not passing route parameters to controller. - MSDN
I am trying to get the values from a form from an action link but there always null for example I have two...
Read more >
Standard URL Syntax - Thymeleaf
<a th:href="@{http://www.thymeleaf/documentation.html}">. They are not modified at all (unless you have an URL Rewriting filter configured at your server ...
Read more >
Integrate with other apps—ArcGIS Survey123 | Documentation
Before using a link that contains parameters to launch a survey in the field app, it is recommended that the app already be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found