HTML5 Data Bindings Support Product Page
Under investigation
Changing Non-field data based upon the value of a field
Reported 10 years ago
1
has this problem
10 years ago 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 10 years ago
10 years ago Teodor Kuduschiev replied:
Hello Chuck,
by field do you mean an input field - text/hidden ?
by field do you mean an input field - text/hidden ?
Replied 10 years ago
10 years ago 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 10 years ago
10 years ago 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:
Then you just can add your rule to it like:
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>