Benjamin Sterling wrote:
> Brice, good stuff, I am using the plugin and it is working great.
>
> Just in case anyone wants to see it in action:
>
> http://ov-staging.informationexperts.com/index.htm 
> <http://ov-staging.informationexperts.com/index.htm>

Benjamin,

  Looks excellent.. it's good to see the plugin put to use.

  You may want to have the confirm (are you sure you want to delete this 
item?) dialog inlined to increase interactivity/page responsiveness. 
Only use ajax to process the request if the user clicks yes -- delete.

  One way you can attach the ID/KEY of the item to be deleted is via an 
onShow callback.

e.g.

If your confirm dialog looks something like;

----
<div id="confirmDelete" style="display: none;">
Are you sure?
<form>
<input type="hidden" name="key" value="" />
<input type"submit" value="no" class="jqmClose" />
<input type="submit" value="yes" />
</form>
</div>
----

   (( note jqmClose is assigned to the "no" button -- I need to update 
my confirm() override example @ http://dev.iceburg.net/jquery/jqModal/ 
with this!  ))

And your delete buttons look something like;

---
<input type="image" src="delete.gif" value="123" class="deleteButton" 
/>  (( where 123 is the items primary key in a DB...))
---

Then you can use jqModal to display the confirmation + attach the ID like;
---

$().ready(function(){
  $('#confirmDelete').jqm({
    trigger: 'input.deleteButton',
    onShow: assignID })
    .find('form')
      .ajaxForm({...}); // assign Mike Alsup's kickass forms plugin to 
handle the ajax submit

  function assignID(h){
    // get the ID from trigger
   var id = h.t.value;

   // assign the id to the confirm form
   h.w.find('input:hidden').val(id);
  }

});

It's that easy & elegant!

Disclaimer:  I wrote this code in my email client, potential syntax 
errors + dysfunctions.

~ Brice

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to