Is it possible to change the max attribute of numberfield dynamically with jquery? AEM 6.4 | Community
Skip to main content
VasconcelosAqui
New Participant
October 26, 2018
Solved

Is it possible to change the max attribute of numberfield dynamically with jquery? AEM 6.4

  • October 26, 2018
  • 5 replies
  • 3090 views

I am currently making a component to set a table dynamically based on a dialog. The problem I am facing is that one of the requirements is "the editor be able to set the width of each column in the dialog", the dialog is already made, and I am showing and hidding the field of columnd width based on the size of the field of Column quantitys, but I would like to change the max of the numberfield based on the somatory with jquery. Is It possible, have someone of you guys made it before?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

Check out the max value on the NumberField:

NumberField — Granite UI 1.0 documentation

Also- when ever the OOTB granite data types do not meet your needs - you can build a custom Sling Resource type using JQuery plug-in. This is shown in this article -where we make a color picker and add the color picker to a component dialog.

Adobe Experience Manager Help | Creating a custom Experience Manager 6.4 sling:resourceType for Touch UI

5 replies

smacdonald2008
New Participant
October 26, 2018

that would be great!

VasconcelosAqui
New Participant
October 26, 2018

Thanks, If I have a evolution I will share with you guys.

smacdonald2008
smacdonald2008Accepted solution
New Participant
October 26, 2018

Check out the max value on the NumberField:

NumberField — Granite UI 1.0 documentation

Also- when ever the OOTB granite data types do not meet your needs - you can build a custom Sling Resource type using JQuery plug-in. This is shown in this article -where we make a color picker and add the color picker to a component dialog.

Adobe Experience Manager Help | Creating a custom Experience Manager 6.4 sling:resourceType for Touch UI

VasconcelosAqui
New Participant
October 26, 2018

I know It sounds "funny", but that is the client requirement, so... What I've done created the js for showing and hiding the columns width(numberfields) and a validation.js in order to only able the editor to submit the dialog if the total width is <= 100, that was done by using a clientlibrary with categories[cq.authoring.dialog] . So I used the use api to retreive that data and put a styles variable in a input type="hidden", after that I created a js in a secondary clientlibrary destinated to the clientSide and in that js I created the css classes dynamically. My requirement is done.

Still... I would like to know how could I change the max attribute of a numberfield, I was trying to do that, but I was not able to know what I should change in the granite numberField that I was getting with jquery selecting a class that I had assigned to each numberfield. Anyway, I already made the component, but I would like to know if you guys have ever made something like that and if yes let me know how, thanks.

smacdonald2008
New Participant
October 26, 2018

YOu need to get the width of the table from the component dialog?