HTML5 Data Bindings Support Product Page

Answered

using data-bindings values inside javascript

Asked 01 Jun 2014 22:08:06
3
have this question
01 Jun 2014 22:08:06 Hans Haverlach posted:
How do I use a data-bindings value ie: {{value_text}} inside a javascript like:
var newvalue = {{value_text}}; //this does not work....


Please advice!!

Replies

Replied 02 Jun 2014 09:03:21
02 Jun 2014 09:03:21 Teodor Kuduschiev replied:
Hello Hans,
Javascript does not allow using: {{value_text}} inside script blocks.
Replied 02 Jun 2014 12:01:06
02 Jun 2014 12:01:06 Hans Haverlach replied:
I know that, that's why I asked the question : How van I use values from data-binding inside a javascript block?
Is there some way?
Replied 02 Jun 2014 12:07:50
02 Jun 2014 12:07:50 Teodor Kuduschiev replied:
No, unfortunately this is not possible.
Replied 02 Jun 2014 12:38:25
02 Jun 2014 12:38:25 Hans Haverlach replied:
O that very disappointing.
I always used the Spry data framework, but thats no longer supported.
But with the Spry data it was no problem to use {sprydatafield} inside javascript, like:
'{sprydatafield}'. It would replace it with the data.
It makes your product much more convenient if you could make it work!
Hope you can take up this challenge :-)

Thanx
Replied 26 Nov 2014 01:27:09
26 Nov 2014 01:27:09 Baub Eis replied:
I was able to get this to work with kind of a work around:

lets say its an address you want to use: {{address}}. wrap it in a html tag of some sort:

<p id="myaddress">{{address}}</p>

Then inside your javascript use
document.getElementById("address").innerHTML



and that will give you the value to use in javascript. You can also use a CSS to hide the paragraph so you can't see it but you can still put the DB value.
Replied 03 Dec 2014 22:57:05
03 Dec 2014 22:57:05 Hans Haverlach replied:
Thanx Baub,

that will work, but it is quite a work around with many values being used in my script.
But thank you for giving your suggestion!
Hans

Reply to this topic