Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

EpiServer Forms: TextboxElementBlock how do I add attributes like maxlength?

Vote:
 

I want to add maxlength to my input textbox (I use epiServer Forms 4.2.1), but I can't do this in epiServer CMS.

There is an option to make this work? There is a clue in the code that it is supported:

<%: html.raw(model.attributesstring) %>



#174340
Jan 24, 2017 17:10
Vote:
 

One of the way is to override display template for this element and take control of resulting markup yourself.

#174354
Jan 25, 2017 7:55
Vote:
 

I understand this is an option, but there is no away to fill this 'AttributesString'? Because when you decompile the source code, you can see that a key value pair is rendered to html properties into the ascx.

I just can't figure out where to fill these values..

#174370
Jan 25, 2017 9:20
Vote:
 

Model.AttributesString is constructed based on available validators for particular form field block.

For instance by default for input field, following validators are available:

RequiredValidator
RegularExpressionValidator
EmailValidator
DateDDMMYYYYValidator
DateMMDDYYYYValidator
DateYYYYMMDDValidator
#174377
Jan 25, 2017 10:52
Vote:
 

BlockBase.AttributeString calls BlockBase.GetAttributes()

If you want to add new attribute to the output of BlockBase.AttributeString, please modify the GetAttributes()

TextBoxBlock is just a built-in element. If you want to change default behaviour of (built-in) TextBox, I think you should override its template and business to your own need, to create your customizedTextBoxBlock element.

#175894
Mar 06, 2017 8:44
Vote:
 

i see email validation on text field doesnt work and we still get spam (in email field as non emails) . How can we enable server side validation for text field ?

#211336
Jan 03, 2020 11:07
Vote:
 

Hi, the EmailValidator will validate on both client side and server side as default. You can disable javascript on browser to see if it validate.

#215749
Jan 13, 2020 6:42
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.