One of X number of colums must contain data
HI all, I am creating a timesheep app and I have five colums that can contain hours worked. When the user enters a new form how do I check to see if at least one of the columns contains data. I must admit I am not a developer just a Sharepoint/Sharepoint designer hack so be nice. Thanks
Glenn T开发者_如何学Gohibeault
The only bullet-proof way would be to create a SharePoint event receiver using C# (lots of examples on the web).
I'm not really sure how you could accomplish this with SPD.
If you don't want to write any C# code, that really only leaves JavaScript. It will still take development work (this is a programming site after all). You could probably take advantage of SPUtility.js (full disclosure, this is a library I maintain).
The basic steps would be:
- Edit your NewForm.aspx and add a Content Editor web part
- Inside the Content Editor web part, write your JavaScript:
- Attach a new
onClick
handler to the NewForm.aspx's "OK" buttons - Use SPUtility's
GetValue
method to get the value of your 5 fields, validate one has a value, and display a message if invalid
- Attach a new
精彩评论