javascript form display information as its being entered

Mobile
feeds
Welcome Login | Register

javascript form display information as its being entered
Reply Your Comments:
Click this button if you are interested in replying to this topic and leave your comments
Sent To Friend
CLick this button if you want to send this page to a friend.
Subsribe To Rss Feeds
Subscribe to RSS
CLick this button if you want to subscribe to this RSS Feed. You can use your browsers feeds burners if you have mozilla or internet explorer 7 or higher and keep up with updates.
  Forums Index
      » Javascipt Forums
        » » javascript form display information as its being entered
javascript form display information as its being entered
Post Description: javascript form display information as its being entered Javascipt
Post Tags:
This Post Has Been Viewed 691 Times Since Tue Apr 15, 2008 8:49 am Author mikeaug2005 with 5 replies
javascript form display information as its being entered
Advertise On This Page




hi, i have a project to do and i want to be able to change the fields on a form on the fly. what i mean by that is that i want to change the value of a field in a HTML form using javascript in real time.

for example, lets say i have a form and i want the user to see the information as they enter it or type it in the browser

i want to have to boxes, one where the user enters the information and the other one where the user sees the information as they enter it. i want the script to show the values each field in the web form to the user

can that be possible?


Leave Your Comments

Your Name
Your Email Address (Will Not Be Published)
Notify Me When Someone Replies to this Page
(An email will be sent to you when someone replies to your comments)
Your Comments
Include A Picture with your comments
Share
| More
Share this page by putting this URL in your comments to other websites like myspace, Facebook, Twitter friendster, Hi5, Groups, Boards, Forum or others. Just Copy and Paste this Code
URL:
To embed this topic, just copy the code from the "Embed" box. Once you've copied the code, just paste it into your website or blog to embed it.
Embed:
BBCODE is use on forums. You can put this code on all your BBCODE enabled forums like PhpBB, vBulletin® and others. Just Copy and Paste this code on your Posts and Replies on your forums
BBCODE:
Subscribe Feeds
Webmasters - Exchange Links With Us. Add related websites to this topic
Add Link:
Links Related to : javascript form display information as its being entered

Comments and replies About javascript form display information as its being entered
:: 1 :: Reply #50254 Reply By javamas On Tue Apr 15, 2008 9:22 am
javamas:
i think so, i think iknow what you mean

Javascript demo

Make changes in this form

Changes appear in this form

Text field:

Text area:


Selected value:

Checkbox:

Drop-down menu:
Selected value:

:: 2 :: Reply #50255 Reply By javamas On Tue Apr 15, 2008 9:34 am
javamas:
where is the code?
:: 3 :: Reply #50256 Reply By hostman On Tue Apr 15, 2008 9:35 am
hostman:

        <style type="text/css" media="screen">
        <!--
div.demoforms form {
    width: 40%;
    margin: 0 3%;
    border: solid 2px black;
    padding: 0 0.5em;
}
div.demoforms form#secondform {
	border-color: #666;
}
div.demoforms span.indent {
	margin-left: 2em;
}
form#secondform {
    float: right;
}
form#firstform p.secondonly {
	display: none;
}
form#secondform p.firstonly {
	display: none;
}

--></style>
<script type="text/javascript">
function fixupMaster (obj) {
	if (obj.childNodes)
		for (var i = 0; i < obj.childNodes.length; ++i) {
			var cobj = obj.childNodes[i];
			if ((cobj.tagName == 'INPUT' && cobj.type == 'text') ||
					cobj.tagName == 'TEXTAREA')
				cobj.onchange = itemChanged;
			fixupMaster (cobj);
		}
}

function fixupSlave (obj) {
	if (obj.childNodes)
		for (var i = 0; i < obj.childNodes.length; ++i) {
			var cobj = obj.childNodes[i];
			if (cobj.id)
				cobj.id += '2';
			if (cobj.name)
				cobj.name += '2';
			if (cobj.tagName == 'INPUT' || cobj.tagName == 'SELECT')
				cobj.disabled = true;
			fixupSlave (cobj);
		}
}

function itemChanged (e) {
	e = e || event;
	var obj = e.target || e.srcElement;
	var switcher = e.type + '/' + obj.tagName +
						(obj.tagName == 'INPUT' ? '/' + obj.type : '');
	switch (switcher) {
	case 'change/TEXTAREA':
	case 'change/INPUT/text':
		document.getElementById (obj.id + '2').value = obj.value;
		break;
	case 'click/INPUT/checkbox':
		document.getElementById ('checkbox2').checked = obj.checked;
		break;
	case 'click/INPUT/radio':
		var fr = document.getElementById ('radios').getElementsByTagName ('input');
		var fr2 = document.getElementById ('radios2').getElementsByTagName ('input');
		for (var i = 0; i < fr.length; ++i)
			if (fr[i].type == 'radio')
				fr2[i].checked = fr[i].checked;
			else
				fr2[i].value = fr[i].value = obj.value;
		break;
	case 'click/OPTION':
		while (obj && obj.tagName != 'SELECT')
			obj = obj.parentNode;
	case 'click/SELECT':
		document.getElementById ('select2').selectedIndex = obj.selectedIndex;
		document.getElementById ('selectval').value =
				document.getElementById ('selectval2').value = obj[obj.selectedIndex].text;
		break;
	}
	return true;
}

window.onload = function () {
	if (! document.getElementById)
		return;
	var f = document.getElementById ('firstform');
	var f2 = f.cloneNode (true);
	f.onclick = itemChanged;
	fixupMaster (f);
	fixupSlave (f2);
	f2.id = 'secondform';
	f.parentNode.insertBefore (f2, f);
	var sel = document.getElementById ('select');
	document.getElementById ('selectval').value =
			document.getElementById ('selectval2').value =
			sel[sel.selectedIndex].text;
}
</script>
 

  
        <div>Javascript demo</div>
        
<div class="demoforms">
        <form id="firstform" action="#" method="get" onsubmit="return false">
            <p class="firstonly">Make changes in this form</p>
            <p class="secondonly">Changes appear in this form</p>
            <p>Text field: <input type="text" id="text" size="20"/></p>

			<p>Text area: <textarea id="textarea" rows="2" cols="20"></textarea></p>
            <p id="radios"><label id="foo">Radio buttons:
            	<label><input type="radio" name="radio" value="one"/> A</label>
            	<label><input type="radio" name="radio" value="two"/> B</label>
            	<label><input type="radio" name="radio" value="three"/> C</label></label><br/>

            	<span class="indent">Selected value:
            		<input type="text" size="6" disabled="disabled"/></span></p>
            <p>Checkbox:
            	<label><input type="checkbox" id="checkbox" value="xyzzy"/> Checkbox value</label></p>
            <p>Drop-down menu:
            	<select id="select">
            		<option>First</option>
            		<option>Second</option>

            		<option>Third</option>
            	</select><br />
            	<span class="indent">Selected value:
            		<input type="text" id="selectval" size="6"
            			disabled="disabled"/></span></p>
        </form>
</div>
:: 4 :: Reply #103879 Reply By Nompumelelo On Wed May 20, 2009 11:11 pm
Nompumelelo:
hi
i appreciate your concern wil you please send for me a code to display user's information in a text area when you click submit using java script and css
:: 5 :: Reply #113732 Reply By scdsac On Tue Aug 25, 2009 3:00 am
scdsac:
dscdsccdscdscdscdscdcds