Maxlength attribute for BP TextBox controls

Hi there all,

Our aspx pages use the maxlength attribute on texboxes to achieve in the UI clear intent and limits to the users. Apparently I’ve not managed to make it work in a similar fashion in the migrated DotVVM page so I ended up with writing some javascript to move this attribute from the BP TextBox div wrapper to its input inner element. It works.


BPC.TextBox and BPC.TextBoxInput being constructed selectors: div.dotvvm-bp-control.dotvvm-bp-text-box and input.dotvvm-bp-control.dotvvm-bp-primitive_text-box respectively.

Is this a correct approach? Can it be achieved in a simpler way?

unfortunately, I don’t see a simpler way to accomplish this. Another way would be to inherit the TextBox class and overwrite the CreateTextBoxPrimitive method.

Yeah, I thought about deriving it also. Thanks!

Thanks for the feedback. We’ll add this attribute (and possibly other attributes that are applicable to the HTML input element) as properties so they can be used.

1 Like