Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > Adobe Web Programming > ActionScript
|
ActionScript Discuss the Adobe Actionscript language
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ActionScript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 18th, 2015, 11:41 AM
Registered User
 
Join Date: Oct 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default help please... newbie at javascript

i just want to create a simple script
i just want to display the value of what i selected radio button to the textbox
here's my code... TIA

<script>
function validateForm() {

//VALIDATIONS
var x = document.forms["myForm"]["ticket_no"].value.length===5;
if (x == null || x == "") {
alert("ticket_no must be filled out or must 5 numbers only");
return false;
}

var x = document.forms["myForm"]["school_name"].value;
if (x == null || x == "") {
alert("school_name must be filled out");
return false;
}

var x = document.forms["myForm"]["region"].value;
if (x == null || x == "") {
alert("region must be filled out");
return false;
}

var x = document.forms["myForm"]["municipality"].value;
if (x == null || x == "") {
alert("municipality must be filled out");
return false;
}

var x = document.forms["myForm"]["comment"].value;
if (x == null || x == "") {
alert("comment must be filled out");
return false;
}




}
</script>
</head>
<body>

<script>
function popitup() {

var w = 900;
var h = 800;
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
var newwindow2 = window.open('','','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+ top+', left='+left);
var tmp = newwindow2.document;
tmp.write('<html><head><title>Region Selection</title>');
tmp.write('<link rel="stylesheet" href="js.css">');
tmp.write('</head><body><p>Select a Region.</p>');

tmp.write('<form name="myForm">');
tmp.write('<input type="radio" name="region" value="Region 1">Region 1<br>');
tmp.write('<input type="radio" name="region" value="Region 2">Region 1<br>');
tmp.write('<input type="button" onclick="myFunction()" value="Submit Region">');
tmp.write('</form>');
tmp.write('<p><a href="javascript:self.close()">Close</a></p>');
tmp.write('</body></html>');
tmp.close();
}


</script>


<script>
function myFunction() {
var region = document.myForm[0];
var txt = "";
var i;
for (i = 0; i < region.length; i++) {
if (region[i].checked) {
txt = txt + region[i].value + " ";
}
}
document.myform.getElementById.value = text;
}
</script>





<form name="myForm" action="add_school.php" onSubmit="return validateForm()" method="post">
<table style="width:30%" border="0">
<tr>
<td><center>ticket_no: </center></td>
<td><input type="text" name="ticket_no"></td>
</tr>

<tr>
<td><center>school_name: </center></td>
<td><input type="text" name="school_name"></td>

<tr>
<td><center>region: </center></td>
<td> <input type="text" name="region" id="order">
<button type="button" onClick="popitup()">Select</button></td>
</tr>

<tr>
<td><center>assigned_to: </center></td>
<td><input type="text" name="assigned_to"></td>
</tr>

<tr>
<td><center>municipality: </center></td>
<td><input type="text" name="municipality"></td>
</tr>

<tr>
<td><center>comment: </center></td>
<td><textarea name='comment' id='comment'></textarea><br /></td>
</tr>

<tr>
<td><center><input type="submit" value="Submit"></center></td>
<td><input type="reset" value="Clear"></td>
</tr>






</table>


</form>
 
Old October 11th, 2016, 02:34 PM
Registered User
 
Join Date: Oct 2016
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

see the first line of validation





Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie (very newbie!) question about com.paad.* jkcashin BOOK: Professional Android 2 Application Development 3 June 5th, 2013 06:52 AM
newbie question (javascript passed in xml) mitre7 XSLT 4 December 11th, 2008 11:23 PM
stop current javascript function using javascript sakthi Javascript 3 June 2nd, 2008 03:30 PM
Newbie - Javascript Mizman Classic ASP Databases 1 January 27th, 2005 02:49 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.