Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Regular expressions on SPcolumns

  Asked By: David    Date: Jan 28    Category: Sharepoint    Views: 1791

I think I know the answer to part of this, but is there anyway to
attach a regular expression to a form (maybe JavaScript with custom for if I
must), I don't want to create a custom column to long, sure wish MS would have
just added a property in the create column form to allow you to enter your
own!!! Anyone know if they did anything like this in 2010?

P.S. If I have to use JavaScript and a customize my newForm.aspx page for the
list is there any good starting tutorials or blogs out on the topic?



6 Answers Found

Answer #1    Answered By: Fidel Crane     Answered On: Jan 28

what are you trying to do????????

Answer #2    Answered By: Akshara Sanghavi     Answered On: Jan 28

You should be able to use a RegularExpressionValidator control on a form
field, but of course it will depend in part  on what kind of data you're

Answer #3    Answered By: Aishwarya Dixit     Answered On: Jan 28

By form  field you mean? Any field listed between <form> tags on the newForm.aspx
page? I want to be able to validate any string fields (single line, multi-lines,
phone numbers, etc.) I want to use single line edit for ssn, ph#, email, etc.
and just make the user conform using regular expressions.

Answer #4    Answered By: Indrajeet Patil     Answered On: Jan 28

The easiest way would be to edit the NewForm.aspx and EditForm.aspx pages of
for the list using SPD and replace the ListView webpart with a DataForm
webpart. Then using the Toolbox in SPD you can add one or more .NET regular
expression validation controls to the page and point them at the individual
controls for the fields you want to validate. The REGEX validation control
will deploy its own JavaScript to do client side validation.

Answer #5    Answered By: Xavier Hopkins     Answered On: Jan 28

I have done that, is there still issues with adding attachments
when you do this? Also if I do that, will the ASP.NET validation control
validate both on the server and the client? that would be nice!

Answer #6    Answered By: Viviana Rollins     Answered On: Jan 28

You will still be able to use attachments on the list, but won't be able to
add them using any form  that has been modified to use a DataForm Web part.
For example, if you switch the newform.aspx to a dataform web part  and add a
validator then you won't be able to add an attachment when creating a new
item. But you would still be able to add an attachment to the item when you
use the edit form to edit an existing record.

Most ASP.NET validation controls do validation on both the server and the
client automatically. The only ones that don't as I remember are the custom
expression validators and they only do validation on the server. As I
remember there aren't any that only do validation on the client.

Didn't find what you were looking for? Find more on Regular expressions on SPcolumns Or get search suggestion and latest updates.