I am trying to create a web-form that has the option to reload previously saved data.
The problem is that when a large string of text that was entered into an autosized textarea has been saved and reloaded it adds a large amount of white space to the text area. [See before save, and after load pictures below]
The form data is loaded by PHP injection of the value as in the following example:
<textarea class='animated' name="courseTitle" id="courseTitle"><?PHP echo ($_POST['courseTitle']) ?></textarea>
The form can be seen in this link. http://pansycheung.com/forms/NewCourseProposal.php?C2EF=0
and data can be loaded into the form in the table below (found at the bottom of the form page).
SELECT THE FIRST FILE TO LOAD
"Phillip Test EECS3603"
The white space disappears when doing one of the following.
Any help with debugging suggestions would be fantastic.
go to ttp://pansycheung.com/forms/NewCourseProposal.php?C2EF=0 to test the form.
THANK YOU!!!
I don't know if this works, but you can TRIM the value of the textarea with trim(). TRIM
You can also use this function in jquery, if this is necessary.
Using jQuery, did you try 'triggering' the autosize?
$('#courseTitle').trigger('autosize.resize');
You initially have to initialize the autosize;
$('#courseTitle').autosize();
If that still doesn't work try putting the 'trigger' autosize in a setTimeOut();
setTimeout(function(){
$('#courseTitle').trigger('autosize.resize');
}, 1000);