Crafter CMS How can a field can be disabled/grayed out in edit mode? - crafter-cms

In Crafter 2.5.x.
Is there a way to have a dropdown to be selected just one and after selected go to read-only mode?

Not out of the box.
To accomplish this, you'll need to change the dropdown control by adding a new property, something like Read-write if empty or Read-only if not empty or similar.
You'll then need to update dropdown.js to respect that field and allow the user to edit the field if the field is empty (meaning the XML element behind it is empty).

Related

update netsuite parent field via suitescript in view mode

I have scripts that react off of, for example, a client Recalc client event. For example, on my form I have a subtab that users may add or remove items from. Based on actions on this subtab (housing a child record of the parent) I would like a field on the parent to update (say to show a total from the children records).
As I was saying, these events seem to work fine if in edit mode but they do not work correctly in view mode. (even in view mode these child records have a "Delete" option at the end of each row in the subtab. This was provided by netsuite by default.
I wondered if anyone had any tips to best allow this parent field to update real time while in updating the subtab rows with the form in view mode.
Thanks.
You can make a custom field on the parent (header) whose value is determined by saved search. For instance, make a saved search that totals the line values by transaction. Be sure to make it filter by transaction in the Available Filters tab. Make the search public so everyone can use it.
Create the custom field that sources the total from the saved search. Make sure to uncheck the "Store Value" checkbox, as you don't want to store the data, you want to reference the search results. You do this on the Validation and Defaulting tab. You'll see a field for Saved Search there. Choose the search you created above.
As you remove/add/change lines on the transaction, the field updates accordingly. In essence, you don't need a single line of code to make this work - it's all in how you create the search and the custom field that references it.
I have a similar situation posted here.
The NetSuite team answered me by email, and it happens you can't really achieve this on the view mode: some API methods are not available. Their suggestion to my case (and I think it applies to yours too) was really to force a refresh on the whole page.
Of course, you can always achieve this accessing the DOM elements directly, but this isn't a best practice, as your code can stop working if these elements change on a version update.
I had the same problem, I'm not able to restrict on view or remove edit button. But, there was one alternative solution with workflows, you can deploy workflow on child record edit mode restrictions, then if the user clicks edit on view then the record will not be available to edit. This concern will apply to custom record as well.

Read only appears like disable control in CRM

I am new to CRM, and I have run into a requirement where I have to show some controls (textbox, option set, etc) and custom entities (sub - grid) as readonly. But, when I made them readonly, they appears like disabled and are getting grayed out. Is there any way to make them only read only not look like disabled?
Please suggest.
Thanks,
Ashfaq.
in CRM read-only means fields are greyed out but still they are readable.
If you want to make the fields visible as normal but don't want them to be editable by the user, you need to write JavaScipt for that.
Take the following steps.
1. Make the fields editable.
2. On form's OnSave Event, call the following method to prevent the attributes to be saved.
function PreventSave()
{
Xrm.Page.getAttribute(“CRMFieldName”).setSubmitMode(“never”);
}
It will not grey out the fields and still prevent the user to change their values.
I hope it will help you.
For text fields, there is one type of text field that when set to readonly does not look like it is disabled. Off the top of my head I can't remember which type. For the other field types I have not found a way to not have them look disabled when made readonly.
Other option is not to use form fields but show the data you need to be readonly (and not grayed out) in a web resource (HTML/SL/etc). Be aware tho that if your users are using outlook with crm addin, there are limitations here when the record is viewed in the outlook reading pane.
Only other option I can think of is to not set the fields as readonly but control any field data changes with javascript.
In short, I haven't found a good way to do what you need.

SharePoint 2010 - How to make a field Read-Only AFTER it loads

I have a field that contains a number that is "system generated" when I open the Newform1.aspx form (I made this the default new item form). If I make the "Requisition Number" field read only, it doesn't allow the system to write to it with the new number. I would like the system to be able to write the new number to the field "as the form loads" and then make the field Read-Only after the number is generated and written to the field. Is there a way to make this happen? When I just changed the ControlMode to "Display" it makes the field read only, but displays the Requisition Number from the first item in the list.
Not sure how exactly you are adding this field.
If you have added the field using code or manifest, you can set field.ShowInEditForm = false;
If you are adding it using UI directly then there is no easy way to update ShowInEditForm property but there is one codeplex project which can help u
http://www.greggalipeau.com/2008/03/10/column-permissions-in-sharepoint-list/
tx,Sandeep
Are you using an event handler? You can use ItemAdding to update the field then set it to read only after the field is added.

With SharePoint/InfoPath: Is it possible to switch default views, and then save this setting with a button?

So lets say that I have two views, one that is the default and another that can be triggered with a button. Is it possible to switch views, then have the view that you switched to become the default view? So that if the form were opened again it would still be on the view you switched to?
If not, is there a way to have a part of a form read-only to a certain group in SharePoint and editable to another group?
Or even better, could I have an email sent out to with different views to different people?
Thanks!
No, it's not possible to set the default view with a button/code. You'd want use a different approach (something similar to the State Machine Pattern)
Create a "State" field, that represents the actual state of the form (usually the same as the views). So when the button is pressed, it sets the State-field to "View2" and switch the view to View2. In the form load rules (Data - Form Load) you create a new Rule that changes the view based on the value State-field.
Yes, setting different section of the form to read-only for specific groups is also possible, however it requires custom code. For each section create a new field (like "Section1Enabled"). Then create a new conditional formatting rule that disables Section1 if Section1Enabled is false. In your form's load event, you add code that that decides whether the current user is in the specific group or not and based on that, you set the value of Section1Enabled.
You can do with SharePoint's UserGroups.asmx or with the SharePoint Server Object Model (google should help you out with that).

Showing fields as readonly in Edit Form of List Item in SharePoint

I have a list which has 5 columns in it. Some of these fields help the user fill in the data but I don't want the user to modify these fields.
I have tried changing the field to readonly but that ends up hiding the field completely from the form. Is there a way to get the field to render out to the form as just text?
Maybe I need to use javascript to disable the fields programmatically - would prefer not to go down that route though..
You must define your own RenderingTemplate that will use your own, custom ListFieldIterator. (an excellent article)

Resources