We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Are entry controls created by SfDataForm supposed to ignore [StringLength] in a model?

I was expecting that the Entry.MaxLength property would be set to restrict the length of the text entry based on the corresponding model property's StringLengthAttribute.MaximumLength property.

Thanks,

Chris

4 Replies

JN Jayaleshwari N Syncfusion Team February 12, 2019 04:53 AM

Hi Chris,  
  
We have checked your query regarding StringLengthAttribute.MaximumLength property in SfDatForm Xamarin Forms. According to DataForm, StringLength.MaximumLength property is used for validating the editor value. String type property can be validated using this attribute.  
  
You can refer our online user guide documentation link below.  
  
Please let us know whether the provided solution satisfies your requirement. If not, kindly revert us back with more details related to your requirement with screenshots (if possible). It will be helpful for us to provide you possible solution.  
 
Regards, 
Jayaleshwari N. 



CM Chris Marinacci February 12, 2019 08:32 AM

Hi Jayaleshwari,

I was expecting that StringLengthAttribute would work the same way that it does in ASP.NET -- the input field associated with the property that has the StringLengthAttribute does not allow the user to physically type more characters into the field than the value of StringLengthAttribute.MaximumLength. This is in addition to its use in validation.

Thanks,

Chris




SG Swathi Gopal Syncfusion Team February 13, 2019 04:37 AM

Hi Chris, 
 
Currently we are analyzing your query related to restrict to type the characters into the editor field when exceeded than the value of StringLengthAttribute.MaximumLength property in SfDataForm Xamarin Forms. We will analyze and update you the details in two business days (Feb 15,2019). We appreciate your patience until then. 
 
Regards,
Swathi G
 



JN Jayaleshwari N Syncfusion Team February 15, 2019 01:01 AM

Hi Chris,  
  
As mentioned in our earlier updates, in DataForm, StringLength.MaximumLength property is used for validating the editor value. String type property can be validated using this attribute. However, your requirement to restrict the user to physically type more characters into the entry field can be achieved using DataFormTextEditor in dataform. Entry is loaded in DataFormTextEditor and its properties (like MaxLength) can be accessed in the override methods of the DataForm text editor.  
  
We have created a sample for the same. In the sample used DataFormTextEditor and restricted the characters in entry using MaxLength property of entry for the FirstName data field in the dataform. You can download the same from the following location.  
Sample link: DataForm_Editor
 
 
Please let us know if this solution meets your requirement.   
 
Regards, 
Jayaleshwari N. 


Loader.
Live Chat Icon For mobile
Up arrow icon