Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a drop down box form field (with values level1,level2) in SharePoint list. How can I lock the drop down box selection in the edit form.aspx whenever the condition is level2?

share|improve this question
add comment

4 Answers

Out of the box, there is no way to lock a drop-down.

The only solution I see is to attach a custom script to the page that will delete the level1 option as soon as level2 is selected. Then there's no way back.

Note that it only locks the edit form (your question). Users would still be able to use a datasheet view, Web services or other to force the value to level1.

share|improve this answer
add comment

You can do something similar to what you want, if you use an InfoPath form as new/edit page for your list.

Here is an example on how to make a custom InfoPath new/edit form for your list.

See here how to customize list forms with InfoPath
http://sharepoint.microsoft.com/Blogs/GetThePoint/Lists/Posts/Post.aspx?List=8d9e2a99%2Df288%2D47c2%2D916b%2D2f32864f7b82&ID=320 And here
http://cakriwut.wordpress.com/2010/03/21/sharepoint-2010-howto-start-customize-list-form-neweditview-using-infopath-designer-2010/

Havent looked into locking dropdowns in InfoPath, but this should get you going so you can experiment with that part of it.

Another option is to create a custom ASP.NET new/edit form
Here is an example on how to do this

http://community.bamboosolutions.com/blogs/sharepoint-2010/archive/2011/05/12/sharepoint-2010-cookbook-how-to-create-a-customized-list-edit-form-for-development-in-visual-studio-2010.aspx

share|improve this answer
    
Thanks Anders! for pointing me to the customizated list forms(aspx)...this is wat i was looking for some time ago –  spStacker Jan 30 '12 at 17:39
add comment

Is this a cascading thing that SPServices can help with? The SPCascadeDropdowns function helps you tie two columns together, making the available options in the second depend on the choice for the first.

If this isn't the case, then some custom script to disable to select is another possibility.

share|improve this answer
add comment

as suggested by Mark, i used custom script to disable the dropdown based on condition

var getselectTag = document.getElementsByTagName('select');

for(j=0;j<getselectTag.length;j++)
{
if(getselectTag[j].title =='Support Level')
{
 if(getselectTag[j].value =='2nd Level')
{
getselectTag[j].disabled = true;
}
}
 }} 

the for loop takes time to execute .. any suggestion on how to replace this javascript by jquery?

share|improve this answer
    
Replacing JavaScript by jQuery won't remove the loop... –  Christophe Jan 30 '12 at 19:11
    
You can do a tighter selection with jQuery, but you probably can also do so with plain JavaScript. You're finding all of the selects and looing through them to find the right one (which ought to be fast). –  Marc D Anderson Jan 30 '12 at 20:25
    
Well to optimize that loop a bit, just break out of the loop after "getselectTag[j].disabled = true;" –  Jussi Palo Jan 30 '12 at 20:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.