How do I hide certain fields from different templates in 2sxc apps using Formulas? - dotnetnuke

I have an App called "Features"
In Features, I have these fields:
Heading
Text
Image
The app has two separate razor templates. One of the templates displays an image, and the other one does not.
How can I hide the "Image" field from Template B, but still display it in Template A? Is this possible with Formulas? If so, how?

Yes, this can be done with formulas ;)
Best check out the current Content Templates, the basic-content (text/image) templates have exactly this implemented.
If you open it from a template which doesn't show images, the images-field is hidden (but the editor can reactivate it). So this is quite sophisticated, you can also do simpler implementations.
Basically the steps are:
Create an ephemeral field which just serves as a temporary variable to determine if it should be shown by default or not - we usually call it something like VarShowImage - probably default to true (so if it's not set, it's true when the form loads) https://docs.2sxc.org/basics/data/fields/ephemeral.html
In the toolbar where it should be hidden, prefill this like VarShowImage=false
On the field which should be hidden, create a formula to control visible based on this field

Related

How do I conditionally show or hide fields on a Layout in Filemaker 14 Advanced?

I'm new to creating Layouts in Filemaker (I'm not using the latest version; am using Filemaker 14 Advanced instead), and I need to know: How can I conditionally/programmatically hide and show drop-down menus on the Layout, based on a selection in another drop-down menu? For instance: Let's say I have a drop-down menu called "Race," and it has three selections: "Human, Vampire, Werewolf." If I choose "Human," I want another drop-down menu called "Class" to appear; if I choose "Vampire," I want a different drop-down menu, called "Clans," to appear instead; if I choose Werewolf, then I want a drop-down menu called "Tribes" to appear. How can I engineer this using Filemaker's built-in language, or is there some other way to do it? Step-by-step instructions and/or code, please; like I said, I'm really, really new to this and to databases in general. Thanks!
You can conditionally hide layout objects by putting a calculation in the Hide Object When blank in the Behavior section of the Data tab on the Inspector palette.
That said, there are relational ways to have your dropdowns change their contents based selections in other fields. That is a lot more flexible, but (of course) more complex. What you want to set up is called a Dynamic Value list and is based on the values in a related table, filtered by the choices you made in the previous fields.
The calculation basically boiled down to just a single "equals" statement, or a bunch of them, simply singling out the value that would need to be selected in order to hide the layout objects I wanted hidden. Thanks for the help, guys! :-)
In my case, I wanted the new dropdown menus to stay shown even if many options were chosen in the first menu. I used the Pattern Count function (https://fmhelp.filemaker.com/help/10/fmp/en/html/func_ref3.33.73.html) to specify that if the answer to the last dropdown menu contained this optioned checked, the new menu would be shown by writing the following : Not PatternCount(table::variable;"text in one of the options")

Sitecore MVC Checkbox

In Sitecore MVC, FieldRenderer.Render(Item, "Field Name") automatically checks its field type. In another word, all XSLT extensions (sc:text, sc:image, sc:date, …) is affected by the RenderField pipeline.
But, I couldn't find sc:checkbox information and it doesn't show "CheckBox" in page edit mode. It just shows the value of the check box.
How can I make it show as like input type=checkbox in page editor?
Sorry for the link only answer but the general approach here is to use a Field Editor Button.
This will open a pop up window with the content editor style control for the field.
If using a custom experience button is not an option for you, you can output different markup (i.e. your input button) to the client when the page mode is in 'Edit' mode.
This will allow you to present the author with the controls you wish to display, but still output the normal output values for end users.
If you are able to use controller renderings, you can use the controller to load a different view to make this easier, but otherwise you can use if statements within your View to output different markup.

Drupal 7 - how can I control content layout in a view?

I've been handed a design spec which requires a news listing in a specific format - e.g. image floating to the left, with the main title and content on its right.
I've created the articles listing using the views module and embedded the view as a block on the front page. However, I need to change the layout of the resulting list of items at an html level, as the items are not provided in the order or within the html tags that I need in order to deliver the design.
In order to style the output, I really need the views module to give me fine-grained control over the html tags being wrapped around each field for each article.
Is this possible in Drupal?
(edit: please note, this is not a css question - I know how to float and position things in css. I need to be able to modify the html tags applied to fields in a view - thanks!)
When you go to your view, you will see FORMAT. You can change the Format to HTML list with corresponding settings. Under Show, you will say Fields. In the FIELDS area, choose which content you want enabled. Let me know if this helps, or if you want more of an explanation. Go back into your view and click on your field. The next window that pops up should be to configure that field. You'll see style settings where you can define the HTML tags, classes, wrappers, etc.

Adobe CQ5.5 how to create multiple CustomMultiField to be used in a single component

I have a requirement which requires me to use a single dialog with two tabs. Each tab should have a CustomMultiField (multiple sets of four fields). I do not know anything about EXT JS. Can some one point me to right direction where I can find something about requirement as above.
I have built custom components without any explicit understanding of Ext JS. To understand how to set up a dialog with tabs, look at the code for the page component in /libs/foundation/component/page. A directory of all the xytpes you can use, like MultiField, is here.
If you need something that behave like one, but is not necessarily huge specific ExtJS component or custom xtype, and you do not want to dig hundreds of Adobe ‘support’ pages, trying to find some piece of useful doc.
You can simply use multifield xtype and write 4 pure JS listeners, that does what you need.

Conditional Formatting based on layout view

Another question for you Filemaker Pro experts. The database I am developing starts with a Main layout with a number of buttons (e.g. insert new item, show all items, etc.). Each button is associated to a script, which takes the user to the relevant layout. In each of these layouts I show the buttons in a row, and highlight the current layout with inverse colour.
My problem is that some of the buttons lead to the same layout, viewed in different modes, and I don't know how to conditionally highlight the right button.
For instance, Insert new item and Show all items take to the same layout, however in the first case the script views the layout as a form and inserts a new record, while in the second I view as a list and show all records. The layout is the same, though, so I'd need to enact a conditional formatting based on something. How do I do that, and what should I check against?
Thanks in advance for any help.
Regards.
Presumably you are currently using the formula: Get (LayoutName) to decide on your conditional formula, why not try additionally using formulas: Get(WindowMode) and Get(LayoutViewState)?
You could conditionally format the button if (which sends user to MyLayout in browse mode):
Get(WindowMode)=0 and Get(LayoutName)="MyLayout"
Or (which sends user to MyLayout in form view):
Get(LayoutViewState)=0 and Get(LayoutName)="MyLayout"
.
Other functions which may help could be Get(FoundCount) and Get(TotalRecordCount). You can see the entire list of Get functions here.

Resources