Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Moving a multiline text field on an edit form drops data

$
0
0

I have a standard editform on a custom list that needs to move rows around a bit depending on a value of another field. My code works fine for most fields, but if I try to move a multiline text field to another location on the form I lose data.

 I use CEWP on this form with this general code:

.... references to jquery here ....

$(document).ready(function() {

var requestType = $("select[title='Task Type']").val();
if(requestType == "Catalog Request") {
		moveCRRows();
	}

});
function moveCRRows() {
   var elemTarget = $('nobr:contains("Character Count")').parents('tr:first');
   var elemSource = $('nobr:contains("Task Details")').parents('tr:first').eq(0);
   elemSource.insertAfter(elemTarget);

}

Task Details is a Multiline text field defined as 'rich text' (we came from 2010 so most of our fields were defined as rich text not enhanced rich text).

If I leave this code in place, the 'Task Details' row moves properly but the field is empty and all data is lost on a save.

It does not do it for me or for everyone, seems to be computer/browser (IE) dependent. I had a similar problem with timing issues with people pickers and had to use a setTimeout call to a function, but I'm not sure if this is the same type of problem. I'm showing just one move, I'm actually moving 7 other rows around.

Multiline fields have lots of parts in the DOM - is it possible that I'm trying to move the row before it's all there, even though the document is 'ready'? Is that what I need to do, put function moveCRrows into a window.setTimeout call?


Robin


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>