I have 3 radio groups on my page. When user selects a value in the first radio group, if it is a particular value, the selection in the other two radio groups gets reset to default and they get disabled to prevent changing them.
The issue is that built-in apex Disable action uses disable javascript property so the value of the radio groups gets removed from session. It would need to use javascript equivalent to readonly, which, as far a s I know, does not currently exist in apex.
How can I get around this issue to enable/disable the radio groups based on a selection in another radio group while still being able to access selected value from my code?
Part of the problem is that readonly doesn't apply to radio buttons, as per the spec. Here's a solution that should work for you but be sure to test in multiple browsers...
Add this function to the Function and Global Variable Declaration attribute of the page:
function preventRadioSelection(e) {
e.preventDefault();
$(this).blur();
}
Add this CSS to the Inline attribute of the page:
.sudo-disabled+label {
opacity: .5;
cursor: default;
pointer-events: none;
}
When you need to Disable an item, use the Execute JavaScript action with the following code:
$(this.affectedElements).find('input').on('click', preventRadioSelection).addClass('sudo-disabled');
Then set Affected Elements to the item(s) you want to disable.
When you need to Enable an item, use the Execute JavaScript action with the following code:
$(this.affectedElements).find('input').off('click', preventRadioSelection).removeClass('sudo-disabled');
Then set Affected Elements to the item(s) you want to enable.
Keep in mind that all of this is client-side, and could be worked around by someone that knows what they're doing. You'll need to enforce your business rules with server-side validations.
Related
I'm trying to update Display Only page item with a dynamic action on one select lists and want to display the value in that display only item.
My code works and page item gets set but once I try to submit the page I get an error: Session state protection violation: This may be caused by manual alteration of protected page item P1_TEST_ITEM. If you are unsure what caused this error, please contact the application administrator for assistance.
I know for hidden items I can just turn off the Value Protected but that is different for Display Only page items as there is no option to turn off value protected. How can I fix the issue?
There is a doc on MOS (1461271.1) explaining this is expected behavior since apex 4.1.1
Here are some workarounds
Define item as text
Set Advanced > Custom Attributes to readonly OR Advanced > CSS Classes to apex_disabled
Alternatively, if you want to use Read Only, then you could use a computation on page submit instead of a dynamic action.
Simply turn off "Send On Page Submit" under settings of that item and it should work.
I have a list applet with a drilldown in one of the columns, and I want to enable or disable it based on another field's value. Something like a dynamic drilldown, but instead of choosing a different view, I want to disable the navigation for some of the records.
Can this be done in Siebel 7.8?
Ideally without server scripting... and definitely without ugly browser scripting hacks, please.
I have tried creating a dynamic drilldown, but it doesn't work because I have to specify a target view in my parent default drilldown. If I use an inactive view for that, then the whole dynamic drilldown is ignored and Siebel simply uses the one with the next sequence number.
I can think of a couple of ways to implement it, but both are far from ideal:
Writing some server script to detect the drilldown event before it happens, and abort it if needed with a RaiseErrorText message. It should be doable... but I'd rather disable the drilldown than throw an ugly error to my users.
Placing the drilldown in a calculated field, and make it have no text when there should be no navigation. If there is no text, there is nothing the users can click to drilldown, right? But I would have to add a new column just for the drilldown, which would be confusing for the users.
If you don't want any scripting. There are 2 ways.
First way is using toggle applet.
1.Main Applet will have the drill down down object. And Toggle applet will not have the drill down objects.
2.Create a field in the BC to use it in the Toggle Applet condition .Toggle Applet will be displayed when the drilldown is not required.
Second way you can achieve it is through visibility Type attribute in the drilldown object as well as visibility Applet Type attribue at the view level.
I have a apex report page where there are multiple submit buttons for each region of charts display. Each submit button is supposed to have same dynamic actions- the dynamic action is supposed to run if user does not selects any data so an error message will pop up and this dynamic action I want to work for all the buttons, so instead of adding dynamic action which is common for every button , I want to define it somewhere in the code so that it can be called during click of any button.
How this can be done?
What you can do is assign the same CSS class to all the buttons you want your dynamic action to fire on. Let's say you assign a class .mybutton to all the buttons in your chart regions.
Second create your dynamic action.
Event: Click
Selection Type: jQuery Selector
jQuery Selector: .mybutton
Define the condition if you need to. Go on with Action etc.
So now your dynamic action will be fired whenever the user clicks on a button with the .mybutton class.
If you need to identify each button by ID when clicked and your action is Execute JavaScript Code, you can use thisTriggeringElement.id.
For the particular Dynamic Action, in Condition region, under Condition Type you can select Request is contained within Expression 1 and give your request(button request) in Expression 1
I am looking into ember.js, after working with SproutCore 1 previously. I am looking for some examples on how to add and remove views from the DOM as the user navigates the application.
For instance, I have an application that contains a set of cases and each case has a workflow. There are also administration pages, etc.
When the user starts up the app, a dashboard-like user interface is shown. From here the user is able to search or click on a case in order to bring up that case. At this point I want to do the following:
I want to remove the GUI for the Dashboard, and i want to show the GUI for the case - which is a complex GUI in itself with its own set of navigation rules etc.
Also, within the case I want to add and remove portions of the GUI as the user navigates and manipulates the case.
When the user clicks on the "Dashboard" link, I want the current GUI to be removed, and the dashboard to be added again.
As this will be a somewhat large application I am not sure if toggling the isVisible parameter is sufficient, or if other measures needs to be taken in order to not overload the user's browser.
Is there a guide, or an example that shows how to do this ?
WARNING: OUTDATED ANSWER
A view inherits from Ember.View which means it gets some key methods. append(), which appends to body, appendTo(arg) which takes an argument and remove().
The argument is a jQuery style selector of where to insert the element in the DOM.
// my view
App.PartsView = Ember.View.extend({
...
});
// create/insert my view
App.partsView = App.PartsView.create();
App.partsView.appendTo('#partcontainer');
In my code I have a <div id="partcontainer"></div>.
// remove from DOM
App.partsView.remove();
The documentation has a good part on Building a View Hierarchy and later a section on Ember.ContainerView depending on whether you want to do it all programatically or not.
I am working with sitecore and now i needs to hide some of the content item in sitcore.what is the process to hide the content'
Why do you want to hide and what do you want to hide?
You could probably setup security to only allow people with certain roles to read, write, etc certain items (and subitems) or setup that only certain roles can see certain fields.
You can probably find most of what you need here:
http://sdn.sitecore.net/Reference/Sitecore%206/Security%20Administrator%20Cookbook.aspx
Otherwise give an example of what you want to do, it might be easier to help then.
If you want to hide from a role or a user, you can setup permissions accordingly to do so. Please specify the requirement.
Perhaps not exactly what you need, but it's not really clear. You can hide items from regular (= non-admin) users by setting the checkbox Hidden as such, which can be found in the Appearance section of your item. When hidden, your items will be displayed in grey and italic in the item tree for administrators, and totally non-visible to users. Note that if you cannot find the section, you need to enable the Standard Fields under View in the ribbon.
Of course this field is also accessible via the API by any of these two means:
item.Appearance.Hidden = true; // Or false.
item[Sitecore.FieldIDs.Hidden] = "1"; // Or string.Empty.
Hide items from non admin users by using 'Hide Item' button in configure ribbon.
Protect items from non admin users by using 'Protect Item' button in configure ribbon.