HTML5 Data Bindings Support Product Page

Under investigation

Changing Non-field data based upon the value of a field

Reported 30 Mar 2015 17:18:09
1
has this problem
30 Mar 2015 17:18:09 Chuck Borrelli posted:
I have a field that is the buyer field. If the value of the database field "source" is X, it is one value, if Y, it is another value. The buyer field is not in the database.

Now, I can easily do this with the mysql query If or Case, and that's what I did. but how would I do complex page manipulations with HTML5 data bindings (example below). This was easy with server side, since I know the value of the data PRIOR to building the page... but how do I do this here?

FOR EXAMPLE: Page is dynamic and I am displaying health records
If the value of a field is "cookies" I want one set disclaimers to appear and one set of images and one section to appear

If the field is "Cake" I want another set of disclaimers to appear with different images and layout.

Again, very easy with PHP and postback... but how do I do it with this tool?

Replies

Replied 31 Mar 2015 13:42:21
31 Mar 2015 13:42:21 Teodor Kuduschiev replied:
Hello Chuck,
by field do you mean an input field - text/hidden ?
Replied 02 Apr 2015 00:52:54
02 Apr 2015 00:52:54 Chuck Borrelli replied:
by field I mean database value, visible or not. basically I want conditional sections of the page (static content) to be displayed based upon the value of a database field (column).
Replied 02 Apr 2015 08:44:33
02 Apr 2015 08:44:33 Teodor Kuduschiev replied:
Hi Chuck,
You could use the data.show and data.hide properties included in the data bindings panel, which generates code like:

<div data-binding-show="{{dataBaseField}}">Your Content Here</div>



Then you just can add your rule to it like:

<div data-binding-show="{{dataBaseField == 'cookies' }}">Your Content Here</div>

Reply to this topic