views:

2125

answers:

2

How does one verify a text field with another list's column? I am currently populating a Drop down list with a datasource and then comparing the text field with items in the dropdown using javascript. Is there a better way?

The second problem I am having is how to trigger the Validate Function.

I am aware of two custom forms for adding data to a sharepoint list. One is created using The Dataview Webpart in Sharepoint Designer and the other is created using the List Form Webpart in Sharepoint Designer.

I have a DataFormWebPart I created using Sharepoint Designer Insert Dataview ->Insert Selected Fields as New Item Form. This gives Save and Cancel buttons at the end of the form. How do I intercept the Save button event?

I found one solution but it only works with the NewForm page that has OK Cancel Buttons. http://www.codeproject.com/KB/sharepoint/Control_validation.aspx

+1  A: 

You'll have to use an event handler if you want to validate the state of multiple fields. You can use the ItemAdding/ItemUpdating events if you want to cancel an item which is being added/updated.

properties.Cancle = true; properties.ErrorMessage = "Your validation message.";

http://msdn.microsoft.com/en-us/magazine/cc163318.aspx

http://blogs.msdn.com/brianwilson/archive/2007/03/05/part-1-event-handlers-everything-you-need-to-know-about-microsoft-office-sharepoint-portal-server-moss-event-handlers.aspx

JMD
A: 

I think you are trying to build a tool like this one called SharePoint Form Validation.

If so, take a look at this blog: http://office.microsoft.com/en-us/sharepointtechnology/HA101054791033.aspx?pid=CH100650061033

Hope this helps!