Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Multiline hidden field value's string padded in HAML
<!DOCTYPE html>
<html>
<head>
<title>HamlPlayground</title>
<link rel="stylesheet" media="all" href="/assets/scaffolds-07f6f551a374e3569370d2d26dba981d.css?body=1" data-turbolinks-track="true" />
<link rel="stylesheet" media="all" href="/assets/testers-069e88c06b889877799890854d7f4c40.css?body=1" data-turbolinks-track="true" />
<link rel="stylesheet" media="all" href="/assets/application-a6772d2c79915825e0baf618a303d51b.css?body=1" data-turbolinks-track="true" />
<script src="/assets/jquery-eb3e278249152b5b5d5170b73d9dbf52.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/jquery_ujs-0b8f09cf5aec4ba1be1abd9f915c77e2.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/turbolinks-924184401b7d116eadaaefc96895fa84.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/testers-8f6eecd1178ef85964369ec66d33c4f1.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/application-9d71a2f6dda6b569ca80f60714aabe8b.js?body=1" data-turbolinks-track="true"></script>
<meta name="csrf-param" content="authenticity_token" />
<meta name="csrf-token" content="1Y/sMn8OBLfXKqCKioxu5JKxj4SxiQu2sLxNfwIo2MsdKZGIvCJCrxhlVRICOJG+b2mjjkHlyv2B8/cDo41OgA==" />
</head>
<body>
<h1>New Tester</h1>
<form class="new_tester" id="new_tester" action="/testers" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="&#x2713;" /><input type="hidden" name="authenticity_token" value="Udhzdk3E27o0LyBZTWGJQYOz6lkH4eJ5eNXXGhKvP7CZfg7Mjuidovtg1cHF1XYbfmvGU/eNIzJJmm1mswqp+w==" /> <div class='field'>
<label for="tester_notes">Notes</label>
<textarea rows="10" cols="20" name="tester[notes]" id="tester_notes">
</textarea>
<input class="tester-notes" value="This is a
multiline string,
which is helpful
for testing!
" type="hidden" name="tester[notes]" id="tester_notes" />
</div>
<div class='actions'>
<input type="submit" name="commit" value="Create Tester" />
</div>
</form>
<script>
(function() {
$(function() {
var notesText;
notesText = $('.tester-notes').val();
console.log(notesText);
return $('textarea').val(notesText);
});
}).call(this);
</script>
<a href="/testers">Back</a>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>HamlPlayground</title>
<link rel="stylesheet" media="all" href="/assets/scaffolds-07f6f551a374e3569370d2d26dba981d.css?body=1" data-turbolinks-track="true" />
<link rel="stylesheet" media="all" href="/assets/testers-069e88c06b889877799890854d7f4c40.css?body=1" data-turbolinks-track="true" />
<link rel="stylesheet" media="all" href="/assets/application-a6772d2c79915825e0baf618a303d51b.css?body=1" data-turbolinks-track="true" />
<script src="/assets/jquery-eb3e278249152b5b5d5170b73d9dbf52.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/jquery_ujs-0b8f09cf5aec4ba1be1abd9f915c77e2.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/turbolinks-924184401b7d116eadaaefc96895fa84.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/testers-8f6eecd1178ef85964369ec66d33c4f1.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/application-9d71a2f6dda6b569ca80f60714aabe8b.js?body=1" data-turbolinks-track="true"></script>
<meta name="csrf-param" content="authenticity_token" />
<meta name="csrf-token" content="1Y/sMn8OBLfXKqCKioxu5JKxj4SxiQu2sLxNfwIo2MsdKZGIvCJCrxhlVRICOJG+b2mjjkHlyv2B8/cDo41OgA==" />
</head>
<body>
<h1>New Tester</h1>
<form class="new_tester" id="new_tester" action="/testers" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="&#x2713;" /><input type="hidden" name="authenticity_token" value="Udhzdk3E27o0LyBZTWGJQYOz6lkH4eJ5eNXXGhKvP7CZfg7Mjuidovtg1cHF1XYbfmvGU/eNIzJJmm1mswqp+w==" /> <div class='field'>
<label for="tester_notes">Notes</label>
<textarea rows="10" cols="20" name="tester[notes]" id="tester_notes">
</textarea>
<input class="tester-notes" value="This is a
multiline string,
which is helpful
for testing!
" type="hidden" name="tester[notes]" id="tester_notes" />
</div>
<div class='actions'>
<input type="submit" name="commit" value="Create Tester" />
</div>
</form>
<script>
(function() {
$(function() {
var notesText;
notesText = $('.tester-notes').val();
console.log(notesText);
return $('textarea').val(notesText);
});
}).call(this);
</script>
<a href="/testers">Back</a>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.