Reading values from input fields
Nice!
That's the first time I see the Tiggr() function.
Documentation anywhere?
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
Nice!
That's the first time I see the Tiggr() function.
Documentation anywhere?
Sorry, forgot to add that.
Tiggr API: http://gotiggr.com/api
Link from this page: http://help.gotiggr.com.
Now we are talking!
Thanks Max.
Well, I must be missing something basic...
The API documentation is sparse. It would help to have a small working code for each method.
I was successful at creating a custom code that uses data from an input field on the same screen.
When I moved that input field to another screen (keeping the button in place), this didn't work (tested in browser, not device) - I got a javascript error that the ID is undefined.
Did you copy&paste the input/button component? Make sure the id's on components are the once you use in JavaScript.
I did copy paste, noticed the ID changes, updated it (btw, when using Cut&Paste the ID also changes, for no reason imo).
Now, here is the simplest way to reproduce the problem. Bottom line, I am getting the error in my firebug:
precomponents[id] is undefined
[Break On This Error] return components[id].__element
impl.js, line 114
/pre
I have created a public app, if you want to see:
http://gotiggr.com/preview/21862/
To reproduce:
ol
liCreate a page with input field named "search" and with default text "test"/li
liAdd a button, with onclick event, to launch custom javascript (see javascript below)/li
liTest in browser, this should work (launch a google search)/li
liCopy the button to another screen (and add a button on this screen to go to the new screen)/li
liTest again, this time, press the button on the second screen to launch the search/li
liThis is where I get the error/li
/ol
Javascript for the button:
precodevar s = Tiggr('search');
window.open('http://www.google.com/search?q='+s.val(), 'NewWindow', 'width=600,height=400,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes');
/code/pre
If I understand correctly your steps, Test That Form From Here button shouldn't work as there is no input field on that page, it's a different page.
So IDs can't be referenced cross-page?...
So (if above is true), the only way to make such a scenario work, is that if the page with the input field stores its variable in local store, and then the submit button uses that local store?
If so, it would be great if you can share a small JS snippet that stores a variable and "alerts" a stored variable. I could not figure it out from the API documentation (e.g. should I use "new Tiggr.Storage()", or should I use the sample code that is provided there or what....)
P.S. We can move this discussion to email if more appropriate.
It might be possible but you need to reference the window id as well.
I think a better way is to use local storage, as you suggested. On click you would save the value into local storage and read it on the second page.
You can do it with Set Local Storage Variable action - for saving.
To read the value, use Set Property and bind to local storage for reading the value. Let me know if you want to see an example.
Thanks Max, will try on my own the two approaches and communicate on (the probably inevitable-) failure...