486 return false; |
486 return false; |
487 }); |
487 }); |
488 return false; |
488 return false; |
489 } |
489 } |
490 |
490 |
491 |
491 function inlineValidateRelationForm(formid, rtype, eid, divid, vid) { |
492 function inlineValidateRelationForm(formid, rtype, eid, divid, reload) { |
|
493 try { |
492 try { |
494 var form = getNode(formid); |
493 var form = getNode(formid); |
495 var zipped = formContents(form); |
494 var zipped = formContents(form); |
496 var d = asyncRemoteExec('edit_relation', 'apply', zipped[0], zipped[1], rtype, eid); |
495 var d = asyncRemoteExec('edit_relation', 'apply', zipped[0], zipped[1], rtype, eid, vid); |
497 } catch (ex) { |
496 } catch (ex) { |
498 log('got exception', ex); |
497 log('got exception', ex); |
499 return false; |
498 return false; |
500 } |
499 } |
501 d.addCallback(function (result, req) { |
500 d.addCallback(function (result, req) { |
502 handleFormValidationResponse(formid, noop, result); |
501 handleFormValidationResponse(formid, noop, result); |
503 if (reload) { |
502 var fieldview = getNode(divid); |
504 log(result[1]); |
503 fieldview.innerHTML = result[2]; |
505 //document.location.href = result[1]; |
504 // switch inline form off only if no error |
506 } else { |
505 if (result[0]) { |
507 log(result[2]); |
506 // hide global error messages |
508 var fieldview = getNode(divid); |
507 jQuery('div.errorMessage').remove(); |
509 // XXX using innerHTML is very fragile and won't work if |
508 jQuery('#appMsg').hide(); |
510 // we mix XHTML and HTML |
509 cancelInlineEdit(eid, rtype, divid); |
511 fieldview.innerHTML = result[2]; |
510 } |
512 // switch inline form off only if no error |
511 return false; |
513 if (result[0]) { |
512 }); |
514 // hide global error messages |
513 return false; |
515 jQuery('div.errorMessage').remove(); |
|
516 jQuery('#appMsg').hide(); |
|
517 cancelInlineEdit(eid, rtype, divid); |
|
518 } |
|
519 } |
|
520 return false; |
|
521 }); |
|
522 return false; |
|
523 } |
514 } |
524 |
515 |
525 |
516 |
526 /**** inline edition ****/ |
517 /**** inline edition ****/ |
527 function showInlineEditionForm(eid, rtype, divid) { |
518 function showInlineEditionForm(eid, rtype, divid) { |