CakePHP show and hide form fields dynamically - cakephp

I have a CakePHP website used by multiple clients. Each client shall be able to see slightly different input fields in forms. This is due to client preferences.
A simplified example:
Clients should be able to look up books from a big list. While some clients prefer to look up by author, others might want to look up by publish date or title. But each client should only see one input field in his search page. I don't want to bother the client with too many choices.
While creating different themes and switching them for each client is an option, it quickly becomes a lot of work if we are talking about many views and many input fields. Same for placing lots of if/else in the view files.
The Controller logic could be shared for all clients, as an empty or not existing input field will be ignored by my controller when looking up books.
Optimal I have some kind of dynamic configuration which states for each client which input field to show or hide on which page.
Let me know any suggestions on this or what is a good CakePHP way to achieve this.

If I get this right just use an element per client:
echo $this->element('client_forms/' . $clientIdentifier);

Related

How can I provide options inside slots with Watson Assistant

I want to get multiple information from a certain node using slots.
One thing is, I want to give options for some of the questions I prompt.
Example: the user will make a reservation. I'm capturing date and time with the slot, and also where does he want the table. For the table part, I would like to provide him with two options "inside" or "outside".
Is that possible using slots?
This feature is coming soon. At this point, you need to export the entire workspace json and manually edit it there, we don't have GUI support just yet.

Find where and how objects are used in Salesforce.com

I have recently taken up salesforce.com and i have very little idea about its workings and stuff. Recently i was going through some of the stuff and i had a doubt...
Is there any way through which i can find out where an particular field/ object/ visualforce page has been used in an application. For example lets say i have a field labeled Sales, i want to be able to find where that particular field is used, under which object, and the object in which visualforce page/ Apex class, and the visualforce page/ Apex class is used in which application.
Hope i have made my Q clear.
Thanking everyone for their help
It's not really a programming question, you might be better off asking about administrative stuff like that on salesforce.stackexchange.com.
If you have a test environment (sandbox) - you could always try deleting the field there ;) I'm kidding but if you'll try it the page should display you a list where the field is being used.
Similar thing could be achieved by creating a changeset, adding that field to it and then checking dependencies.
But probably the best way would require some preparations upfront. Read about Force.com IDE (or Eclipse IDE) and how to use it to download files that represent your object definitions, page layouts, classes, visualforce pages, reports... This is great as backup but also will let you search the files (Ctrl+H in Eclipse or just use whatever you want once you have the files locally). Search for API name of the field (similar to My_Custom_Field__c should be most effective.
Pretty old thread but adding another option. I have a free and open source app that scans the fields in your Org and returns the components it's used in (Workflows, Processes, Page Layouts, Apex etc).
Keep in mind that returning fields in Apex and VF is not 100% accurate, as a field with the same API name on different objects would return as being found in a class, even though it might not (as others have mentioned).
Also, it can take quite a while to run on large Orgs.
App: http://schemalister.herokuapp.com/
Source Code: https://github.com/benedwards44/schemalister

Can you use GEO IP to display different menus depending on region within one website

I work for a business that has offices in 4 regions, UK, US, Dubai and Singapore. Each region offers slightly different products. I’m planning on using a mega menu dropdown in the primary navigation.
My question is, is it possible to display different menu items depending on what region the user is in? I would’ve thought it would be possible using GEOIP however I’m not sure. I don’t want to build 4 separate websites as the content is virtually the same.
If anyone come across this issue before?
Thanks
Mark
It is possible to do this with IP Geolocation using a product such as MaxMind. Depending on your particular needs, you could use a web service, a JavaScript service, or a downloadable database:
http://dev.maxmind.com/geoip/
That said, geolocation is not perfect and you may occasionally display the wrong content to the user. Since having four separate sites seems to be an option, you might want to consider one site with four different country-specific domains and then display the menu based on the domain that the user visits. For instance, this modules seems to do just that:
https://drupal.org/project/domain_menu_access
I am sure there are other modules that can be used in this way.

Should we create custom pages for all objects?

I noticed that salesforce doesn't allow to override control function for all objects.
Say if you want to do something whenever objects get saved there is no way to attach the action
unless you create a custom page and include either standard controller or extension. Or if you want
to add the same meta-tag on all pages I run into this limitation. Is there better way to do this?
Generally - no. Roughly speaking if Salesforce doesn't allow you to do something it usually means there's pretty good hint you're doing in it wrong. I realize it sounds like I'm a fanboy but in reality - can you expand your question with concrete example why would you want to do something like that? For example governor limits are evil, annoying etc. - but they force you to write effective code that doesn't strain the database too much.
if you want to do something whenever objects get saved
That's what triggers are for. Ask yourself a question if the "action" you need to make should happen only from web UI or also when performed from API (mass data load, a smartphone application etc).
if you want to add the same meta-tag on all pages
You could maybe pull off similar result by adding a component to the sidebar. It won't cover all cases (like accessing Reports/Dashboards) but it's hard to say more without knowing what you're really after. Then again - custom VF page overrides won't help you when it comes to Reports either.
I wanted to add this as a comment, but was unable to.
Anyways, For the example that you mentioned in the comment, You can add that jQuery plugin in the Home page side bar component and activate the plugin only on those custom objects where you wnat to run this plugin. You might already know that we can deduce which object a record belongs to by looking at the 1st 3 letter of the record Id, using this logic, check if the record belongs to the custom object you want your plugin to act on and run the plugin.
But As eyescream has pointed out adding script in side bar has its own limitations: you cannot use the global variables , side bar components are not loaded on the reports and dashboard tabs etc.
-ಸಮಿರ್

Multiple Updates in Drupal

I want:
1. To be able to update multiple sites with one upload
2. News page will now database driven
3. Updates in common elements likes LOGOS, COUNTRIES, ADDRESSES, TELEPHONES, FAX NUMBER and EMAIL ADDRESSES can be done with limited HTML knowledge
Hello guys..Is this possible in Drupal 7?
Thanks
It is possible.
But you might need to search for right module or write your own. You might need install the features module or the domain access. But what you are asking is quite general question, with Drupal everything is possible. But you might need to write PHP code for matching your special needs.

Resources