Sharepoint web part form validation blocks updating web part settings -


i have written web part in c# sharepoint 2007 has single field validated required field using requiredfieldvalidator(). web part has configuration fields (ones edit clicking on modify shared web part).

when make changes these fields , try apply them, validation of user field kicks in , prevents update, though not submitting form. trying submit settings. web part may used in few places on our farm, site collection administrators need able change settings - @ moment not friendly enough these users so.

here validate user field:

// validate form field - required field, , max length 100 characters. inputformrequiredfieldvalidator messagerequiredvalidator = new inputformrequiredfieldvalidator(); messagerequiredvalidator.controltovalidate = txtmessage.id; messagerequiredvalidator.errormessage = "you must write message send!"; messagerequiredvalidator.display = validatordisplay.dynamic; messagerequiredvalidator.text = "<img src=\"/_layouts/images/cnsca16.gif\"/> must write message send."; tc.controls.add(messagerequiredvalidator); 

here define 1 of configuration fields:

private string recipientemailaddress = "sender@domain.tld";     [webbrowsable(true),     personalizable(true),     webpartstorage(storage.shared),     webdescription("email address form should sent to"),     webdisplayname("recipient email address"),     spwebcategoryname("email settings")]     public string recipientemailaddress     {         { return recipientemailaddress; }         set { recipientemailaddress = value; }     } 

this first web part have written, there may subtleties missing in how admin configuration , validation of user submitted fields.

ok - i've found key this. can add validationgroup property each validator, , button causes validation. changed code include:

messagerequiredvalidator.validationgroup = "userinput"; 

and similar property submit button. when click on ok in toolpane, doesn't validate userinput validation group. happens when click on submit button.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -