Opened 10 years ago

Closed 10 years ago

Last modified 8 years ago

#9635 closed defect (invalid)

Zend_Dojo_Form uses JSON for constraints that in the NumberTextBox results in that the max value is ignored

Reported by: mgordon Owned by:
Priority: high Milestone: tbd
Component: Dijit - Form Version: 1.3.2
Keywords: Cc: Adam Peller
Blocked By: Blocking:

Description

When using Zend_Dojo_Form with NumberTextBoxes? it produces these constraints: constraints="{'min':'0','max':'4','places':'1','pattern':'##0.## cm'}"

After an ugly quickfix I got this constraint that works: constraints="{min:0,max:4,places:1,pattern:'##0.## cm'}"

That doesn't work since during initialization the max value is set to 900000000000 after being parsed in the parser.js. I've narrowed it down to this part of code:

213 var markupFactory = clazz["markupFactory"];
213 if(!markupFactory && clazz["prototype"]){
214   markupFactory = clazz.prototype["markupFactory"];
215 }
216 // create the instance
217 var instance = markupFactory ? markupFactory(params, node, clazz) : new clazz(params, node);
218 thelist.push(instance);

Attachments (1)

test.html (1.3 KB) - added by mgordon 10 years ago.

Download all attachments as: .zip

Change History (5)

Changed 10 years ago by mgordon

Attachment: test.html added

comment:1 Changed 10 years ago by Adam Peller

Cc: Adam Peller added

comment:2 Changed 10 years ago by bill

Resolution: invalid
Status: newclosed

It works correctly when you use the correct types:

constraints="{min:0,max:4,places:1,pattern:'##0.## cm'}"

(min and max are numbers, not strings)

It's not supposed to work when you pass in strings, so I don't see this as a dojo bug... sounds like something that Zend needs to fix.

comment:3 Changed 10 years ago by mgordon

I'll report this issue to ZF but it seems that the problem is somewhere in the handling of a JSON. I've checked and you're right, the following works also fine:

constraints="{'min':0,'max':4,'places':1,'pattern':'##0.## cm'}" 

The I've found the origin of the problem that is due to the ini-file data always being processed as strings.

comment:4 Changed 8 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.