How to validate data input on a sharepoint form? - sharepoint

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

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

can you add query strings into the formula box for validation?
e.g. like this:
^[a-zA-Z]{2}[0-9]{6}[A-Za-z]{1}$
which validates against a national insurance number.
sharepoint says the column must = true,
so could I enter something like
[column name] = ^[a-zA-Z]{2}[0-9]{6}[A-Za-z]{1}$

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!

Related

Powerapps how to choose fields that are submitted to SharePoint list

I have taken over a project from someone who has left the business.
It is a Microsoft PowerApp which provides users with a form interface to upload items into a SharePoint list.
The submit button in the app works and the function is "SubmitForm(formName)"
My question is how does it know which fields to submit into which column in SharePoint?
for instance if I wanted to create a textbox in the form for "First Name" how would I make the powerapp submit the contents of that textbox into firstname field?
--edit removed screenshot--
I think you lack knowledge of powerapps w.r.t sharepoint.
Go through one of the example mentioned in docs of micro soft and you will get idea of how mapping of fields are done.
Your main concern is mapping fields.
https://learn.microsoft.com/en-us/powerapps/maker/canvas-apps/app-from-sharepoint
If you check your edit form, and click on any of your field/data card you will find settings as below. Here I have created custom column as "NumberColumn" and you can find Data properties same for your field as well.

Add Custom Button to Sharepoint 2013 List Item

In a Sharepoint 2013 list of items, is it possible to add a couple of columns that feature my own custom action buttons? These buttons would be on each list item (row) and perform an action specific to that row. And I'm sure it's not possible, but will Sharepoint allow NO labels for their column headers?
The caveat is that the powers-that-be may not want to see fields for those two extra columns in the New or Edit forms for that list.
Please bear with me on what must be a totally noob question. I am a designer with very elementary knowledge of Sharepoint that has been thrown to the Sharepoint wolves, so to speak. Thanks!
I'll try to help you as much.
If you want to make a change before saving, you can insert a javascript on the form you desire.
Before saving the Sharepoint runs a javascript code with "PreSaveAction" function, eg PreSaveAction function () {your code; return true}
Do not forget to put return true or return false. You will return true place to save and return false to not save.
The cancel button or close the form performs no function but can insert a javascript button manually.
I use Sharepoint Designer 2013 to open Sharepoint, and after that open the desired form. After opening the form will contain two Sharepoint Button. You can make a display: none a button and insert a button with your javascript function.
Anything I am available to help you.

Save Infopath form w. dynamicly created fields in Sharepoint 2010 Library

I am very new to Infopath, and need some architechtual guideslines. My scenario is as follows:
I have a Sharepoint list, let's say it contains beer, and three items of it: "Kronenbourg", "Corona", "Tuborg". "Beer" is a content type, derived from Item.
What I need to do :
I need to create a "dynamic" Infopath form, that presents the user with a CheckBox for each beer. If a new beer is added to the Beer list, a new Checkbox should show up on the form without intervention, even on saved instances of the form. I have not decided what should happen upon deletions.
I then need to save this infopath form, including the selections, in a sharepoint form library, so that the users can go back to one of maybe many beer-forms that they have saved, and maybe change the selections.
I also need to build a string from the selections at some point in time, and present this string in a visible column in the form library, but thats beyond the scope of this post.
What I managed to throw together so far:
I have a kind of working Infopath form. I have added a sharepoint dataconnection to the Beer list, and dragged a repeating table to the design area. This "works", i get a list of my list items. I then added dummy Y/N field to my beer content type, selected it in the fields, and now i get a neat checkbox next to my records.
Obviously this does not seem right. I do not need to save anything back to the Beer table, I only need to use the beer table for lookup, and keep the selected choices in the saved instance of the form.
Ok, thanks for staying with me so far. What do I do here, can Infopath be persuaded to support a scenario like this, or am I better off building custom webparts? I think my main questions are:
Can I maybe attach an "input-only" CheckBox to a repeating list/section ? (and how do I refer to such dynamically created control)
How do I make Infopath load the choices dynamicly from db, but save the data in the instance of the form?
Should, and can I maybe attach a content type to the form library, representing the choices and somehow attach that to the form?
Thanks for any input
If I understand your requirements, I think the thing to do here is to use a Multi-Selection list box (MSLB). This can have its values populated from a secondary data source (i.e. a list), and it would be bound to a repeating field that would automatically have values added and removed as values are selected and deselected.
As far as getting the selections into a single string, if you just want this value for a column of the form library that the forms will be submitted to, you can just use this repeating field as a promoted property, and use the "Aggregate" option to combine the values into one.
The other option would be to create a separate field to hold the string and use the "double eval trick" (please Google that) to combine the values into one. One gotcha here is that if you use double eval trick with a MSLB, you have to put the formula both in a rule on the MSLB's field, and in the default value formula for the target field.

Sharepoint 2007 : How to disable TextBox

I am new to sharepoint 2007. I have a following requirement.
1) I would to create a custom list for employee where they can select the item and fill-out the form and submit.
Example : List --> Hard Disk --> Click --> Create new list -->
List has following fields 1) EmpID 2) Customer name (Text) , 3) Order Date, 4) Qty 5) Price
Once user submit the list then I would like to disable the EMPID field and allow same user to edit the other fields if required.
How can I disable the text field (Empid) in the Sharepoint 2007 ? I would appreciate any other alternate or better idea.
Thanks,
Regards
Vick
I would use jQuery for this purpose. Here is an example that describes how to hide a text field on a SharePoint form. Change the .hide() to .attr('disabled','disabled') and this will disable the text field.
If you need help with deploying jQuery, see this question.
I am not sure its a better idea or not, but for that i used to do for this common scenario
that
fist identify the textbox id in html source (through web browser view source) after that i wrote javascript function to disable textboxes i.e. EMPID or we can do through style sheet and apply style using javascript..
You can create multiple content types for the same list. Have the user fill out the content type that contains the EmpID field (put a link in the LeftNav that sends them to NewItem.aspx with the proper ContentTypeId). Make the default content type the one without the EmpID, so when they go back in and edit they won't see that EmpID field.
The downside to this is that they'll see both content types in the New button dropdown. You can name them in a way that makes sense (New Hard Disk Order, Edit Hard Disk Order)

Custom column in list

Can any one tell me that, Is is possible in wss to have our custom column in a view of list. The way how we are adding edit and delete column in asp.net grid by setting autogenerateedit button property to true. I have to write my custom login on click event of that button. This action is going to be common for all list items.
Thanks
Sachin K
I am afraid that it is not possible out of the Box in SharePoint (WSS / MOSS). If you want to have such an option, you might need to create a Separate page that will have code to do the opertion. Try out the SPGridView and SPDataSource.
Else I would suggest (Recommend) you to have a look at the DataSheetView option provided by the List, it will list List item details as all editable format, like Excel sheet.

Resources