[SUCS Devel] [Git][sucssite/sucs-site][master] 2 commits: Fix addresses not to being inserted into the textarea with line breaks

Imran Hussain imranh at sucs.org
Mon Oct 12 20:04:45 BST 2015


Imran Hussain pushed to branch master at sucssite / sucs-site


Commits:
9d09d161 by Imran Hussain at 2015-10-12T19:48:19Z
Fix addresses not to being inserted into the textarea with line breaks

- - - - -
270da506 by Imran Hussain at 2015-10-12T20:04:41Z
Merge branch 'master' into 'master'

Fix addresses not to being inserted into the textarea with line breaks

See merge request !30

- - - - -


1 changed file:

- htdocs/js/signup.js


Changes:

=====================================
htdocs/js/signup.js
=====================================
--- a/htdocs/js/signup.js
+++ b/htdocs/js/signup.js
@@ -214,7 +214,16 @@ $(function(){
 	
 	//populate the address box when an address is selected
 	$("select#addsel").change(function(){
-		$("textarea#address").val($('select#addsel').val().replace(/, /g,'\n'));
+	
+		// everything is shit and will strip out the line breaks
+		// so we have to do weird shit with innerHTML
+	
+		// store the entire options as e
+		var e = document.getElementById("addsel");
+		// store the selected address's innerHTML as strUser (because stackpver flow copy and paste)
+		var strUser = e.options[e.selectedIndex].innerHTML;
+		// set the text area to the strUser var
+		$("textarea#address").text( strUser );
 		$('div#addressmessage').attr("style","color:green; float:right; clear:right;");
 		$('div#addressmessage').html("OK");
 		validation['address']=true;



View it on GitLab: https://projects.sucs.org/sucssite/sucs-site/compare/15751affc636bef0012b0e8887575f692edafbc7...270da5061dc4d270995a0f84c4233517dbee9b37
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sucs.org/pipermail/devel/attachments/20151012/da324488/attachment.html>


More information about the Devel mailing list