How to get form field value before passing the form validation?

django

Solution

I think this is what you're describing -

def transaction(request): 
    if request.POST.method == 'POST':
        post = request.POST.copy()
        if 'amount' in post:
            post['amount'] = post['amount'].replace(',','')
        tform = AddTransactionForm(request.user, post)
        #...

(you have to create a copy of the `request.POST` dictionary because it's immutable).

Problem

My question is related to this link: How to allow user to input comma So I'm trying to do all the possibility just to make it work. Now I'm trying to get the value pass when performing saving action before it validates by the form.is_valid(). I'm successfully get the value by doing this: ``` ......... if request.method == 'POST': if request.POST['process'] == 'addtrans': tform = AddTransactionForm(request.user, request.POST) print tform.fields['amount'] // this is the value that I want to get if tform.is_valid(): .......... ``` But sadly the output is this: ``` <django.forms.fields.DecimalField object at 0x7fcc84fd2c50> ``` How to get the exact value or decode that output? I hope someone have tried this one.

Original source