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 custom SharePoint list with several fields. Two of the fields are TargetPage and ExternalURL. At the moment the user is allowed to fill out both of them if he want to, and I want to deny that. How can I "validate" the form before it's submitted so that the user is only allowed to fill out one field at a time?

share|improve this question
add comment

1 Answer 1

up vote 11 down vote accepted

A simple solution is to just validate the fields on submit by adding a validation rule in the list settings.

  1. Go to List Settings
  2. Open Validation settings under the General Settings area

In the formula add your formula, I think it will be like this in your scenario:


=OR(IF(ISBLANK(TargetPage),NOT(ISBLANK(ExternalURL))),IF(ISBLANK(ExternalURL),NOT(ISBLANK(TargetPage))))

And add a user message in the list input field.

Or you could do this easy with InfoPath form, or some javascript to hide fields if there is text in one of them. I'm sure there is lots of approaches. But the solution i posted is an out of the box solution if that's a criteria for you.

share|improve this answer
    
hey, thank you! :) –  CodingSheep Nov 10 '11 at 12:53
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.