Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

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

VasconcelosAqui
Level 3
Level 3

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?

1 Accepted Solution
smacdonald2008
Correct answer by
Level 10
Level 10

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 Touc...

View solution in original post

0 Replies
smacdonald2008
Level 10
Level 10

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

VasconcelosAqui
Level 3
Level 3

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
Correct answer by
Level 10
Level 10

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 Touc...

VasconcelosAqui
Level 3
Level 3

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