jdyoumans
Newbie
Posts: 1
Registered: 7/17/2004
Member Is Offline
|
| posted on 7/18/2004 at 01:49 AM |
|
|
Use a function for format
I would like to use the format option with a function instead of the default options. So I have a js function that checks a date and returns ture or
false that is called isDate(dtDate). I have tried to do 'f':'isDate(txtdate);' but it does not seem to work. Any suggestions?
|
|
|
tigra
Administrator
Posts: 2043
Registered: 6/17/2002
Location: US, CO
Member Is Offline
|
| posted on 7/20/2004 at 06:57 PM |
|
|
'f':isDate
|
|
|
mmanners
Newbie
Posts: 1
Registered: 1/12/2005
Member Is Offline
|
| posted on 1/12/2005 at 12:16 AM |
|
|
Using a custom function for field format
I have included a excerpt of the code I am trying to get to work. The only thing I have changed is the 'f':'real' to
'f':'inRange' according to your suggestion.
| Code: |
...
var o_fields_test = {
'price' : {'l':'Price','r':true,'f':'inRange','t':'t_price'}
},
...
function inRange(newPrice) {
if( newPrice < 5.00 || newPrice > 20.25 ) return false;
return true;
}
...
|
However, no matter what value I place in the field 'price', it always passes validation.
Can you please help?
|
|
|
tigra
Administrator
Posts: 2043
Registered: 6/17/2002
Location: US, CO
Member Is Offline
|
| posted on 3/1/2005 at 12:54 AM |
|
|
try moving definition of inRange above the structure where you use it and refer to it as 'f':inRange
|
|
|
Filipo
Junior Member
Posts: 2
Registered: 10/5/2005
Location: Bogotá - Colombia
Member Is Offline
|
| posted on 7/7/2006 at 11:43 AM |
|
|
'f':inRange, not 'f':'inRange' without '
var o_fields_test = {
'price' : {'l':'Price','r':true,'f':inRange,'t':'t_price'}
},
|
|
|