0

I have added my custom field type with custom properties. I add question with my custom field type and I check some constraints in OnSaveChange method of my FieldEditor. But I want add additional client validation before user submit "New Question" page. I see that this page have some standart sharepoint validation in javascript function ValidateAndSubmit, by example - this function check if question length is too much. How to add my logic in this validation script to validate my custom properties on the client side?

JIemON
  • 377
  • 1
  • 6
  • 19

1 Answers1

0

Just add a conten editor web part, include your jQuery references and run your custom validation, lets say that your "New Question" button has a given ID,

$("#myNewQuestionButton").click(function{ doYourMagicValidationsHere();});

The trick here is to do your jquery references right and script from a webpart to another.

If need an exemple, just let me know, I have made this trick several times.

Best regards.

ricardordz
  • 235
  • 1
  • 6
  • Thank you. I have already used similar solution. I add jquery script on editor control with Page.ClientScript.RegisterStartupScript in method InitializeWithField of FieldEditor Class. – JIemON May 22 '12 at 09:46