/    Sign up×
Community /Pin to ProfileBookmark

Cut and pasting fields

Okay so i am really new to javascript. Done a little in the past.

What i have is a form that can be used to document events. Users will fill out fields and then hit a “enter” button. The button will cut all the data and paste it in a box. Then they will fill in the data again and hit “enter” and it will cut again and paste in the next line of the box. etc. etc.

I can’t find a clear code to do this. To start. How do i create a “onclick” that will cut “field1” and paste in “field2” if I start there i can get pretty far. Any suggestions?

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@FangApr 20.2009 — <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>form list</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script type="text/javascript">
window.onload=function() {
document.form1.onsubmit=function() {addName(this); return false;};
};

function addName(f) {
f.textarea1.value+=f.first.value+' '+f.last.value+'n';
f.first.value=f.last.value='';
}
</script>

<style type="text/css">
label {display:block;}
</style>

</head>
<body>
<form action="#" name="form1">
<div>
<textarea rows="5" cols="25" name="textarea1" disabled></textarea>
<label>First name <input type="text" name="first"></label>
<label>Last name <input type="text" name="last"></label>
<button type="submit">Add name to list</button>
</div>
</form>
</body>
</html>
×

Success!

Help @speich4fun spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...