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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:





142597 Feb 11,2019 09:03 PM UTC Feb 15,2019 09:01 AM UTC Xamarin.Forms 4
Tags: SfDataForm
Chris Marinacci
Asked On February 11, 2019 09:03 PM UTC

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.



Jayaleshwari N [Syncfusion]
Replied On February 12, 2019 12:53 PM UTC

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.  
Jayaleshwari N. 

Chris Marinacci
Replied On February 12, 2019 04:32 PM UTC

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.



Swathi Gopal [Syncfusion]
Replied On February 13, 2019 12:37 PM UTC

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. 
Swathi G

Jayaleshwari N [Syncfusion]
Replied On February 15, 2019 09:01 AM UTC

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.   
Jayaleshwari N. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon