Welcome Guest, Not a member yet? Register   Sign In
Shopping cart library and input field formating
#1

[eluser]tmengttm[/eluser]
Hi all,

Update:

Previously, i was asking: is there a way to extend/modify ci shopping cart library to make "qty" accept double value. Because it seemed to me that "qty" only accepts integer value. thanks jmadsen, the problem is solved. It turns out that I just need to change the code in system/library/cart file...

Now my questions is:

Is there a way to format input field in such a way: a number with 1 decimal place?
#2

[eluser]jmadsen[/eluser]
At first glance, lines 161 & 332 use a preg_replace to strip non-numerics, including decimals.

If you extend & change those to:

Code:
$items['qty'] = trim(preg_replace('/([^0-9\.])/i', '', $items['qty']));

I think it should work for you.
#3

[eluser]tmengttm[/eluser]
Hi Jmadsen, Thanks, I just found that.
I edited my question a bit. now i want to know is there a way to format input field. i.e when user do input, they'll see the format is sth like: __._ , and whatever they input first will be pushed to decimal place first, then fill other digits..
Thanks
#4

[eluser]jmadsen[/eluser]
uhm...did you just edit & completely change your question? this was about extending the shopping cart a moment ago
#5

[eluser]jmadsen[/eluser]
Uhm.... don't do that again, ok? When you post a question, leave it there for others.
#6

[eluser]InsiteFX[/eluser]
jQuery Validatation Plugin

How to Mask Input with jQuery

#7

[eluser]weboap[/eluser]
http://digitalbush.com/projects/masked-input-plugin/




Theme © iAndrew 2016 - Forum software by © MyBB