Hi all, So I'm wondering what is best practice.
I've got a table that users can click a row and get sent to an edit screen. I'm also sending the users to the same edit screen after data inserts. I'd like to use the same function to handle this. However, when you click the row it returns an event (from being observed). When you insert the data, the function that does this calls ajax.request and returns 'transport'. They both contain a number, though in different formats. So, what is best practice to handle this? The code below works fine if broken into two unique functions, one that handles transport and another that handles event. Seems really redundant to have two so similar. The following is a non-functional 'ideal': function editProfessionalOutreach(event,transport) { var key_ts_prof_outreach_seq; // from row click try { var key_ts_prof_outreach_seq = this.id; } catch (err) { // none } // from insert function try { var key_ts_prof_outreach_seq = transport.responseText; } catch (err) { // none } alert('last:'+key_ts_prof_outreach_seq); new Ajax.Request('dsp_editProfessionalOutreach.cfm? KEY_TS_PROF_OUTREACH_SEQ='+key_ts_prof_outreach_seq+'&'+cfSession, { method: 'get', onSuccess: outputProfessionalOutreach, onComplete: attachProfessionalOutreachEditListeners, onFailure: function(r) { throw new Error( r.statusText ); } } ); } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---