web/data/cubicweb.edition.js
branchtls-sprint
changeset 1798 cc86fe8efaaa
parent 1760 6b97d286eb5a
child 1864 4ceaf8f2709b
--- a/web/data/cubicweb.edition.js	Wed May 13 17:21:35 2009 +0200
+++ b/web/data/cubicweb.edition.js	Wed May 13 19:51:30 2009 +0200
@@ -449,7 +449,7 @@
  * @param eid : the eid of the entity being edited
  * @param reload: boolean to reload page if true (when changing URL dependant data)
  */
-function inlineValidateAttributeForm(formid, rtype, eid, divid, reload) {
+function inlineValidateAttributeForm(formid, rtype, eid, divid, reload, default_value) {
     try {
 	var form = getNode(formid);
 	if (typeof FCKeditorAPI != "undefined") {
@@ -461,7 +461,8 @@
 	    }
 	}
 	var zipped = formContents(form);
-	var d = asyncRemoteExec('edit_field', 'apply', zipped[0], zipped[1], rtype, eid);
+	var d = asyncRemoteExec('edit_field', 'apply', zipped[0], zipped[1],
+                                rtype, eid, default_value);
     } catch (ex) {
 	log('got exception', ex);
 	return false;
@@ -488,11 +489,14 @@
     return false;
 }
 
-function inlineValidateRelationForm(formid, rtype, eid, divid, vid) {
+function inlineValidateRelationForm(formid, rtype, role, eid, divid, vid, default_value) {
     try {
 	var form = getNode(formid);
+        var relname = rtype + ':' + eid;
+        var newtarget = jQuery('[name=' + relname + ']').val();
 	var zipped = formContents(form);
-	var d = asyncRemoteExec('edit_relation', 'apply', zipped[0], zipped[1], rtype, eid, vid);
+	var d = asyncRemoteExec('edit_relation', 'apply', zipped[0], zipped[1], rtype, role,
+                                eid, vid, default_value);
     } catch (ex) {
 	log('got exception', ex);
 	return false;
@@ -506,6 +510,8 @@
           // hide global error messages
 	  jQuery('div.errorMessage').remove();
 	  jQuery('#appMsg').hide();
+          var inputname = 'edit' + role[0] + '-' + relname;
+          jQuery('input[name=' + inputname + ']').val(newtarget);
 	  cancelInlineEdit(eid, rtype, divid);
 	}
         return false;