Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

My problem precisely and concisely is that I developed a simple web part to display OOTB Surveys on the page (Which means user can answer and submit the survey through my web part). It works correctly.

BUT when I add the web part two times, then, User will not be able to submit any of them. Simply because when s/he answer the first survey and click Submit-Button, the required field validation will fire on the other web part and requesting to be filled.

Scenario: (I hope those steps give you better understanding of my case)

1- Assume that I add my SurveyViewer web part to display Voting on the right side of the page. Also, I added again my SurveyViewer web part to display Quiz.

2- The user opened the page and s/he only wants to Vote, So s/he selects and clicks Vote.

3- Nothing gets submitted and the Page will display “Please fill the fields of Quiz”.

Question: How can I submit the Voting without being affected by other instances?

Thank you, and I would greatly appreciate your inputs!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

There are various issues which could be at play here, but essentially you can solve your validation issue by ensuring that the ValidationGroup property of your validation controls is unique to a given instance of your webpart (maybe prefix it with the ClientID property.)

You will need to ensure that your sumbit button is set to not cause validation explicitly and then ensure that when it is clicked you call Validate() and pass in the name of your validation group.

This should fix this issue but not other issues related to multiple instances.

share|improve this answer
    
Thanks Charles for your input. But as I said I'm displaying OOTB Surveys, which means that I don't have access to ValidationGroup property. I think your solution would work if it is custom controls and I can play around with the ValidationGroup property. –  Alex Apr 1 '10 at 13:24
1  
I am not sure what you mean. You are using a custom web part yes? If so how are you rendering the surveys within this? If you tell us more about the mechanics of your solution then someone may be better placed to help you out. –  Charles Lee Apr 1 '10 at 19:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.