Wednesday, October 23, 2013

Add custom button in form

Hi All,

in views.py:
----------------------

   def post_form_values(request):
    if request.method == 'POST':
        form = facultyForm(request.POST)
        if form.is_valid():
            form.save()
            return HttpResponse("Form data saved to database")
            #return HttpResponseRedirect('/draft/')

    else:
        form = facultyForm()

    return render_to_response('base.html', { 'form': form }, context_instance=RequestContext(request))


in base.html:
---------------------------------
 <form action="" method="POST">
{% csrf_token %}
            {{ form.as_p }}
        <input type="submit" value="post" />
        </form>


Here it will generate few fields like:

name: [textbox] i mean <input type=text /> -
url: [textbox] i mean <input type=text /> -
city: [textbox] i mean <input type=text /> -

-----
----
--- etc


My question is: I want to add the button  after url field. Once the user clicks on button I will use the entered url value and extract the details what i want... Please let me know how to add custom button to the form.

------------------------------------

Thanks
Mahantesh



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7c04b1d6-4f59-4d63-9fd9-6e71e89132d5%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate