jquery - django form wizard ajax next step -


i creating 9-step proposal form using django form wizard. well, until wanted use ajax load next step. i'm having hard time configuring ajax call in jquery because django forms don't have action url included in form tag. why anyway? win-win situation me have loading screen next step , if there upload file process in step, show percentage loading uploaded file. thanks!

i'm using code, , it's working me. don't put action inside form, can see. use jquery 'on' function when form submited because form reloading , changing inside div#creation. ajax url must 1 displays form.

in case, first step of form rendered through ajax get, when click on button. that's why there's isn't form in div @ first. (i'm using bootstrap's modals).

<div id="creation">     <!-- form display through ajax --> </div> 

the template reload in formwizard class in views following html:

template_name = 'creation_form.html' 

code por creation_form.html:

<form id="creation-form" action="#" method="post">     {% csrf_token %}     <table>         {{ wizard.management_form }}         {{ wizard.form }}     </table>      {% if wizard.steps.prev %}         <button name="wizard_goto_step" class="btn btn-primary" aria-  hidden="true"    type="submit" value="{{ wizard.steps.first}}">first</button>         <button name="wizard_goto_step" class="btn btn-primary" aria-hidden="true" type="submit" value="{{ wizard.steps.prev}}">previous</button>     {% endif %}     <input id="create-submit" class="btn btn-primary" type="submit" value="submit" /> </form> 

here ajax call:

$('#creation').on('submit', '#creation-form' , function(e){     e.preventdefault();     var fd = new formdata($('#creation-form').get(0));     $.ajax({       url: '/create/',       data: fd,       type: "post",       success: function(data){             $('#creation').html(data);           },       processdata: false,       contenttype: false     }); }); 

hope proper response answer.

i'm having hard time going first/previous step, if figure out please tell me how.

this you're looking for?


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -