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

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.

Related

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

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).

why are field values being erased with an xPage full update (on another field)?

I have an xPage that is behaving very oddly. (if xPages get corrupt, I think this one might be) Tell me what you think:
I have editable fields with onChange events that take the value of the field (a company name) and looks into the database to see if the company already exists. If it does not, a field called "isNew" is set to "y". BUT the next time a Full Update is performed, from another field or button, my "isNew" field (or all of them) are erased! Why on earth would a full update erase a totally different field?
Do I need to just recreate this xPage?
============================================================================
Ok, here's the onChange event on the editable field that sets the flag:
var c = currentDocument.getItemValueString("company");
var id = #DbLookup("","AD",tc,11); // this view column gets the doc ID
if (id==null || id==""){
#SetField("isNew","y")
}
This field is being set properly - I use a computed field to display it. But the next full update (button, field, whatever) will erase the "isNew" field.
I think your problem is caused by the data sources you have on your page and how you save them.
Maybe you have data sources that gets binded from the url that should not be.
Are you using data sources within a repeat or view panel? If so, make sure you are only saving the correct data source
JSF (and thus XPages) works best when keeping MVC in mind. So you never manipulate a component, but keep that component bound to a model, like a data source or a scope. This way code doesn't get into each other's way.
A refresh of a page computes the whole tree, not just the updated field, so you need to design your calls carefully.
Work directly with your data source so do this instead of #SetField():
currentDocument.setValue("isNew", "y")

Lotus notes, edit one form from another

Basically what I want to do is create a form whilst within another form and pass values from the earlier form to the second. Complicated I know but here is what I got.
#Do(#Command([Compose];"LPK"); #SetField("PR_Make"; PR_Make))
The fields in both forms have the same name and this code is called when first document is attempted to be saved.
I think instead of editing the field on the second form it just saves a field as itself instead. Any help appreciated.
The best and common way is to enable form property "Formulas inherit values from selected document" in second form "LPK".
Add a default value formula to second form's fields you want to inherit and put just the name of field itself in. For your example default value formula it would be
PR_Make
Make sure you save document first and then create the new document.
Knut Hermann's answwer is the 'standard' way of achieving such things but there are other methods- eg you can use environment variables ..
Something like:
#Environment("PR_Make") := PR_Make;
#Command([Compose];"LPK");
Then set the default value for PR_Make in your new form as ..
#Environment("PR_Make")
FYI Environment variables are written to the user's Notes.ini file and so remain even after Notes has been closed and re-opened. #Environemt doens't work too well with Web applications as it uses the server's notes.ini.
An alternative would be to use profile documents:
#SetProfileField( "PRDefaults"; "PR_Make" ; PR_Make;#Username);
#Command([Compose];"LPK");
.. in the default field for PR_Make on new form :
#GetProfileField( "PRDefaults"; "PR_Make"; #Username);
Profile documents are stored as a kind of hidden document in the Notes database and persist with the database. The last parameter sets a further subdivision by username so each user gets their own profile doc - a bit like a personal profile for "PRDefaults". You can miss this last parameter #Username out, to have one profile doc per database but there's a risk of two people trying to use it at the same time and clashing.
Profile docs also work with web applications.

Change the name when Customizing CRM 2011

I customize the campaign form and i face the some problem
1.How to customize the name "GENERAL".i need the name instead of GENERAL .Where to change?or which property should i change?
2.cant delete Lock symbol fields if we try , its saying "It is allowed only for business units".How to unlock and How to delete this?
As Guido suggests, double you can edit the name of the tab by opening up the form in the form editor, double clicking on the tab, and changing the label.
As far as the locked field, you'll have to mark the field as not required, in the entity customization, publish your changes, then you can delete the field from the form.
The label for any tab can be changed by the form editor, if you want a dynamic value you can set using supported customization as this example:
var firstTab = Xrm.Page.ui.tabs.get(0);
firstTab.setLabel("new tab name");
If a field is locked, it means that is business required (in your case is the name of the campaign that must be filled), you can always hide the field and pre-fill the value using javascript code inside onload, onchange or onsave events.
Perhaps someone else can suggest a better (i.e. supported) solution but until then - why not find out the id of those elements and edit them directly from JS in onload? Let me repeat, though, that such an operation is unsupported.

Word and Custom Content Types

I have defined a new content type (document) for sharepoint. The problem I have is that word automatically comes up with window allowing updating of these properties (for example effective date) that is not validated and I don't want it to show when the user is uploading changes (I fill in some of these fields on the updated method in the eventreceiver class). Is it possible to disable this or at least customize the word behavior?
You can create your own Document Information Panels: http://msdn.microsoft.com/en-us/library/bb684925.aspx.
Another alternative might be to set the ShowInNewForm/ShowInEditForm properties of the SPField. But im not sure if Word uses them.

Resources