499 try { |
499 try { |
500 var form = getNode(divid+'-form'); |
500 var form = getNode(divid+'-form'); |
501 var relname = rtype + ':' + eid; |
501 var relname = rtype + ':' + eid; |
502 var newtarget = jQuery('[name=' + relname + ']').val(); |
502 var newtarget = jQuery('[name=' + relname + ']').val(); |
503 var zipped = formContents(form); |
503 var zipped = formContents(form); |
504 var d = asyncRemoteExec('edit_relation', 'apply', zipped[0], zipped[1], rtype, role, |
504 var d = asyncRemoteExec('validate_form', 'apply', zipped[0], zipped[1]); |
505 eid, vid, default_value, lzone); |
|
506 } catch (ex) { |
505 } catch (ex) { |
507 log('got exception', ex); |
506 log('got exception', ex); |
508 return false; |
507 return false; |
509 } |
508 } |
510 d.addCallback(function (result, req) { |
509 d.addCallback(function (result, req) { |
511 handleFormValidationResponse(divid+'-form', noop, noop, result); |
510 handleFormValidationResponse(divid+'-form', noop, noop, result); |
512 if (reload) { |
511 if (reload) { |
513 document.location.href = result[1]; |
512 document.location.href = result[1]; |
514 } else { |
513 } else { |
515 if (result[0]) { |
514 if (result[0]) { |
516 var d = asyncRemoteExec('reledit_form', eid, rtype, role, lzone); |
515 var d = asyncRemoteExec('reledit_form', eid, rtype, role, default_value, lzone); |
517 d.addCallback(function (result) { |
516 d.addCallback(function (result) { |
518 jQuery('#'+divid+'-reledit').replaceWith(result); |
517 jQuery('#'+divid+'-reledit').replaceWith(result); |
519 }); |
518 }); |
520 } |
519 } |
521 } |
520 } |