Textfields help

hey guys, ive manage to come up w/ these…
icant figure out though why linebreak doesnt work if i use input boxes, but if i use texarea it works fine, plus can you also help me out by adding a selection box to the equation?



<script type="text/javascript">
var desc = new Array();
desc['a1'] = 'First name';
desc['a2'] = 'Last name';
desc['a3'] = 'Address';
desc['a4'] = 'Zip';
desc['a5'] = 'City';
desc['a6'] = 'Country';

function CopyFields(){
    var copytext = '';
    for(var i = 0; i < arguments.length; i++){
        copytext += desc[arguments[i]] + ': ' + document.getElementById(arguments[i]).value + '\
';
    }
    var tempstore = document.getElementById(arguments[0]).value;
    document.getElementById(arguments[0]).value = copytext;
    document.getElementById(arguments[0]).focus();
    document.getElementById(arguments[0]).select();
    document.execCommand('Copy');
    document.getElementById(arguments[0]).value = tempstore;
}
--></script>	</head>
	<body>
		<p>
			<input id="a1"></br>
			<input id="a2"></br>
			<input id="a3"></br>
			<input id="a4"></br>
			<input id="a5"></br>
			<input id="a6"></br>
			<br />
			<input type="button" value="Copy" onclick="CopyFields('a1', 'a2', 'a3', 'a4', 'a5', 'a6');"> </p>


That’s the point of having different things - text inputs are for single lines whereas textareas are for larger blocks of text that may include linebreaks. If text inputs allowed linebreaks, they’d just be textareas that are one line tall.

plus can you also help me out by adding a selection box to the equation?
Read that again. Now look at your code. What exactly do you want? It’s impossible to tell because you haven’t bothered to explain properly.

yeah, sorry i didnt clarify.

came up with these, problem is that i cant copy what i selected from the dropdown menu and the reset button doesnt work. can i get help?

thanks guys!



<html>
	<head>
		<title></title>
	</head>

<script type="text/javascript">
var desc = new Array();
desc['a1'] = 'issue';
desc['a2'] = 'tel';
desc['a3'] = 'account name';
desc['a4'] = 'caller';
desc['a5'] = 'OS';
desc['a6'] = 'modem';
desc['a7'] = 'router';

function CopyFields(){
    var copytext = '';
    for(var i = 0; i < arguments.length; i++){
        copytext += desc[arguments[i]] + ': ' + document.getElementById(arguments[i]).value + '\
';
    }
    var tempstore = document.getElementById(arguments[0]).value;
    document.getElementById(arguments[0]).value = copytext;
    document.getElementById(arguments[0]).focus();
    document.getElementById(arguments[0]).select();
    document.execCommand('Copy');
    document.getElementById(arguments[0]).value = tempstore;
}
--></script>



	<body>
		<table border="0" cellpadding="0" cellspacing="0" style="width: 500px">
			<tbody>
				<tr>
					<td>
						<table border="0" cellpadding="0" cellspacing="0" style="width: 500px">
							<tbody>
								<tr>
									<td style="text-align: right">
										issue:</td>
									<td>
										<textarea id="a1"></textarea></td>
								</tr>
								<tr>
									<td style="text-align: right">
										tel:</td>
									<td>
										<input id="a2" /></td>
								</tr>
								<tr>
									<td style="text-align: right">
										account name:</td>
									<td>
										<input id="a3" /></td>
								</tr>
								<tr>
									<td style="text-align: right">
										caller:</td>
									<td>
										<input id="a4" /></td>
								</tr>
								<tr>
									<td style="text-align: right">
										os:</td>
									<td>
										<select id="a5"><option selected="selected" value="">Windows 7</option><option value="">Windows Vista</option><option value="">Windows XP</option><option value="">X MAC 10.x</option><option value="">Other</option></select></td>
								</tr>
								<tr>
									<td style="text-align: right">
										modem:</td>
									<td>
										<input id="a6" /></td>
								</tr>
								<tr>
									<td style="text-align: right">
										router:</td>
									<td>
										<input id="a7" /></td>
								</tr>
							</tbody>
						</table>
						<input type="button" value="Copy" onclick="CopyFields('a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7');"> <input type="reset"></td>
				</tr>
			</tbody>
		</table>
	</body>
</html>


Most web browsers are not allowed to copy or paste to the clipboard, for security.
I suggest that you have a separate text areas somewhere for collated data, so that you can copy the fields to there, and manually copy from there.

The reset button only works when it and the fields are inside a form.