.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Custom Form does not save values if field validation occurred

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :SharePoint


I have a custom New form that I am having problems with.  If a user inputs all fields, and the form validation doesn't catch any problems, then the list item is saved with no problems.  


If one of the form fields finds a problem such as a required field that wasn't entered or an invalid name in the people picker, then after the user corrects the problem and presses save the list item will get saved without the correct values from the form fields.  The form fields still display the correct information before pressing save, but the list item that was saved does not have the same values as the form fields.


It seems that SharePoint:FormField are fine, but things such as SharePointBig SmileVDropDownList will display the data after a form error, but will no longer keep the form data and therefore it doesn't get saved.


Has anyone else had this problem?  If so then have you found a fix?

View Complete Post

More Related Resource Links

Setting Task Field Values in Custom .aspx Edit Form and accessing through ExtendedProperties


Since we're using WSS 3.0 and not MOSS 2007, we have to create and use ASP forms for any custom Workflow Task Edit pages instead of being able to use InfoPath forms (which would be nice...maybe some day we'll step up to MOSS). The custom Workflow Edit Pages are used for custom Task Content Types that we create so that our Workflow Tasks can have additional fields beyond the standard Workflow Task fields. Once you've collected the values for the Task fields from the user on the ASP Workflow Task Edit form, the typical procedure is to create a hashtable and fill the hashtable with key/value pairs that represent the names of your Task fields and their associated values, as such:

// This function is called when the user clicks the Save/Submit button
// on the Custom Task Edit ASP form
public void btnSubmit_Click(object sender, EventArgs e)
  // Create a hashtable that will be used to update the values of task fields
  Hashtable taskHash = new Hashtable();
  // For each field, create two values in the hashtable. If the field name 
  // matches a field in the Task content type, the field name will not be 
  // searchable as a key within the ExtendedProperties hashtable. So 
  // create a second field that is a duplicate of the first but having a 
  // name that doesn't exactly match an existing field in the Task 
  // content type. That way it will be a searchable ke

BDC field cannot save on Custom List Form


I'm having a problem with a Sharepoint Business Data Catalog, I have a List which are connected by BDC to a SQL field/table, and with standard sharepoint Forms it all works fine, I can lookup data in BDC and it saves correctly.

However, I need to create a Custom List Form for New Items on this list, and whenever I do this - the BDC works for lookup, but it doesnt save the data in the List when the item is created ?
(All normal fields save, but the BDC field is just empty on the new Item)

Anyone got any bright ideas? Cause I'm running out.

How do you create a custom BDC data field that allows for multiple selected values?

I need help creating a custom data field using the BDC column as a base.  We need to allow for multiple selected values instead of just a single one.  I can't find anything on the net which shows how to do this.

conditionally hide a field in a custom form using SharePoint Designer

I'm able to hide a field based on a security group. but, how do you hide a field based on a value in another field? Custom form opens, if fieldTwo = "taco", hide fieldOne.    

Validation is not working in Custom List Form using JavaScript ddwrt:GenFireServerEvent()

Hii am creating custom New form for a list using sharepoint designer. i have added the below button for sumbit<input name="Submit1" type="submit" value="Submit" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={http://myserver/Lists/VTest/AllItems.aspx}')}" />                <xsl:text xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:nbsp-preserve="yes" disable-output-escaping="yes">&amp;nbsp;                                    </xsl:text><input name="Submit2" type="submit" value="Cancel" onclick="javascript: {ddwrt:GenFireServerEvent('__redirect={http://myserver/Lists/VTest/AllItems.aspx}')}" />the problem is the validation is not working properly. it submits the page without entering values for the required fields.particularly the validation is not working for DateFields.let me know what is the problem here. is it a Bug?muthu

How to add custom field into registration page and save it to database?


Hi all,

I try to construct a membership system using Walkthrough: Creating a Web Site with Membership and User Login. The membership system is going to be added to umbraco cms. I should admit that I am still in the learning process and need your guidance for my question.

On my registration page other than standard fields which comes with CreateUserWizard, I need to add some extra fields in addition to that and those fields should be saved to database along with standard fields.

Is it possible? If it is, how can I manage to do that?



Resize a Sharepoint Field on the Custom list form


Hi All Gurus...

I'm just looking for a way to resize the form field input boxes for a custom list form. I don't think I'm understanding how the displaysize attribute works. It doesn't take "px" or maybe I'm looking at the wrong thing. I know this is a easy question

Pls help its urgent


A __ViewState field is being posted to my form and causing validation to fail. How do I ignore this?


I'm implementing a payment gateway, and it basically works like this:

User will do their shopping at my site, and view Cart.aspx. Cart.aspx will post the form to the payment gateway.

The payment gateway will process the payment, and then do a post back to my server at Response.ashx. It posts the details of the credit card transaction, but it will also re-post whatever I gave it. So it is giving me back a __ViewState field. (ViewState, EventValidation, RequestValidation are all disabled on both Cart.aspx, and Order.aspx, which is the page being redirected to.)

Response.ashx has the following code:

public class Response: IHttpHandler, IRequiresSessionState
public void ProcessRequest(HttpContext context)
new ResponsePresenter

public void

How add custom form field in workflow task using visual studio 2010



I need to create a simple workflow using Visual Studio 2010.

Workflow having following activities:

1. Create a task assign to workflow initiator. This task have one dropdown field with two choice (Approved,Rejected). 

2. Wait for the task change.

3. In Task edit form, only title and custom drop-down field are visible. User need to select from one of the choice and complete the task.

Custom Form Field in Collect Data Action doesnot capture multiple users.


I have a situation where the department head dynamically assigns the reviewers depending on the document that is uploaded. To capture the reviewers I added a Collect Data Action and a "Reviewers" form field, with type "Person/Group" and checked the following properties

1. Allow selection od People and Groups, 2. Choose from all users and more importantly 3. Allow multiple users

Although I am able to enter multiple users in the form, I am able to retrieve only the first user I entered and the rest just.. disappear!

How to assign values to workflow task person or group custom field?

Using visual studio 2008, in createTask_MethodInvoking, I have the following code. RequestFields has the values from the InfoPath form. ApprovingPersons is a person or group field, added to the task list by my custom task content type. I checked the task list associated with the workflow and I see the custom field.

SPUser user;
SPFieldUserValueCollection fuvc = new SPFieldUserValueCollection();
foreach (Contact person in RequestFields.Persons)
      user = workflowProperties.Web.EnsureUser(person.LoginName);
      fuvc.Add(new SPFieldUserValue(workflowProperties.Web, user.ID, user.Name));

// this is the line causing problem, I believe
PreApprovalTask_TaskProperties.ExtendedProperties["ApprovingPersons"] = fuvc;

I got the following error message:

at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] argument



Custom Form with Lookup Field does not validate when it's set to require.


I have a lookup field in my custom new form and it's suppose to pull an id.  However, I have nothing to relate to this, so shouldn't the required validation trigger?

Is there a workaround for this or do I need to take this a step forward and write some custom code?


Thanks in advance!


Null values doesnot show up in custom edit form in a drop down choice menu


Hello guys,

I have a problem. I don't know why custom edit form is behaving like that.

I have a choice drop down with values  " ","Yes","No". For custom  new form, I can insert null values and everything is working fine.

But coming to this custom edit form which I created.  While editing, if we set a value to null and submit the form. It is getting the "Yes" as the value. It is skipping the null value and placing the "Yes" value. I have kept the default value for choice drop down as " ".(null too).

I don't know why it is not showing null value. Do guys have any idea or if came across anything like this. Please help

PreSaveAction is not firing for a custom save button on a Custom List Form

Hi Everybody,
I've created a custom list form using SPD. Now I want to put a custom button for saving and redirecting to another page based on a logic. I am using following script for making a custom Save button.

<input type="button" value="Submit" name="Submit" onclick="{ddwrt:GenFireServerEvent('__commit;__redirect={Confirm.aspx}')}  " />
When the user clicks this button, I am able to save the values, but the validation I have implemented in the PreSaveAction() is not getting activated. I don't understand where the problem is.

Is validation with PreSaveAction()  works only with OOB SaveButton ?

Thanks in advance,
- Loka Samastha Sukhino Bhavanthu : May Eternal Peace & Goodwill Prevail in the Whole World!

Unable to get all the values from a field


Am reading an XML from web service and storing in  a dataset. 
then in write to a DataTable as follows

 DataTable dtResult1 = dsSearch.Tables["RESULTSET"];    
 DataTable dtHIT = dsSearch.Tables["HIT"];     
 DataTable dtField = dsSearch.Tables["FIELD"]; 

The issue  is  in the DataTable dtField i can only see 3 columns FieldID,Name,HIT_ID

The corresponding values in the dataTable looks like this for the corresponding fileds


I am unable to get the Field Name values 1,8799f4646b6ed9acde142581a84f75a6 ,234B5F5F-F247-4EB6-9E39-A7B64C7FE1BD,Yes...etc

What would be the cause for this...Any Help

Below is the structure of the XML-

- <HIT NO="1" RANK="2955" SITEID="0" MOREHITS="0" FCOCOUNT="0"> 
<FIELD NAME="rank">1</FIELD> 
<FIELD NAME="internalid">8799f4646b6ed9acde142581a84f75a6 </FIELD> 
<FIELD NAME="contentid">234B5F5F-F247-4EB6-9E39-A7B64C7FE1BD</FIELD> 
<FIELD NAME="contentids" /> 
<FIELD NAME="collection&

Office Space: Custom Field Types for SharePoint 2007


Custom field types provide a powerful way to define a reusable SharePoint column definitions.

Ted Pattison

MSDN Magazine May 2009

C++ at Work: Form Validation with Regular Expressions in MFC


I thought I'd use this month's column to describe an interesting app I built using the RegexWrap library described in my article "Wrappers: Use Our ManWrap Library to Get the Best of . NET in Native C++ Code" in this issue.

Paul DiLascia

MSDN Magazine April 2005

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend