jquery - 2 AJAX forms on same page: prevent open one if the other is already oppened -


i have page user views data 2 forms. 1 called data part 1 , other data part 2. 2 forms, @ top, have button edit user can edit forms in same pages.

when user clicks edit, sends ajax request php controller , return html rendered input fields filled. works.

my problem want prevent user clicking on first edit , second edit. if he's editing part 1 (or part 2), has save , can edit second. when save form don't save via ajax, form sent normal http form.

how can that? it's explained or need image example?

thank in advance

update:

<h2>     form1     <a id="projects_historics_edit_part_1" href="#" class="submitbutton submit insideh"><span>edit</span></a> </h2>   <div id="projects_historics_part_1">     <!-- display form 1, when click @ button edit inside h2, loads form via ajax --> </div>  <h2>     form2     <a id="projects_historics_edit_part_2" href="#" class="submitbutton submit insideh"><span>edit</span></a> </h2>   <div id="projects_historics_part_2">     <!-- display form 2, when click @ button edit inside h2, loads form via ajax --> </div> 

a few options, can possibly wire edit buttons javascript functionality disable other edit button, pending save.

button1's onclick:

$('#button2id').attr('disabled', 'disabled'); 

then on save...

$('button').removeattr('disabled'); 

alternatively, set hidden field flag if have 1 form or other open, , check hidden field's value before execute ajax create form.


Comments

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -