/    Sign up×
Community /Pin to ProfileBookmark

Simple Noob Updating before ‘Submit’

Hello,
I am new to programming. I have made a script that displays a “Drop-Down Box” and outputs the selection of the “Drop-Down Box” to a “TextBox”.

I don’t want the value sent to a textbox, but rather an output that cannot be modified by the user, and that has no borders. Perhaps outputting it as text or a PHP variable. Using “document.write()” Clears the page and ONLY displays the variable, this is not what I wnated. Can anyone help, or send me a link with a good example?


————————————————————————————————————————-

<html>
<head>
<title>Testit Out</title>

<script>
function ShowTotal(number)
{
//Writes the selected number into the textbox
form1.Textbox.value = number;
//
//TODO: Change a variable value instead of the textbox value
//
}
</script>

</head>
<h3>Toad Order Form</h3>

<form action=”auto.php” method=”post” name=”form1″>
Select how many Toads you would like:

<select id=’NumberT’
onChange=”javascript: ShowTotal(document.getElementById(‘NumberT’).value)”>
<option value=’0′>Number of Toads
<option value=’1′>1
<option value=’2′>2
<option value=’3′>3
<option value=’4′>4
<option value=’5′>5
<option value=’6′>6

</select>

<br><br>
You Have Selected
<INPUT TYPE = TEXT NAME=”Textbox” SIZE=”1″>
Toads <br>
<input type=”submit” value=”Next Step”>

</form>

</html>


————————————————————————————————————–

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceMay 24.2006 — I don't want the value sent to a textbox, but rather an output that cannot be modified by the user, and that has no borders.[/QUOTE]
You can still use a text box ... just give it the [B]readonly[/B] attribute and [B]style[/B] the element such that it has no borders -- simple and sweet.
Copy linkTweet thisAlerts:
@idnMay 24.2006 — You should maybe look into the DOM to do this properly. Another way if your starting off is to look at the innerHTML function. For example you could have a <div> tag

<div id='assignSomeId'></div>

then

onChange="javascript: document.getElementById('assignSomeId').innerHTML = this.value">

You can then style the div in CSS or in the innerHTML (which isnt the best way for readability purposes)

onChange="javascript: document.getElementById('assignSomeId').innerHTML = '<div style="fontSize:100px">this.value</div>'">
Copy linkTweet thisAlerts:
@BomberFlakauthorMay 24.2006 — Thank You for your Help!!

//In the Body

<div id='assignSomeId'></div>

and

//Within the script

document.all.assignSomeId.innerHTML = "This text goes where the Dividers were!"
×

Success!

Help @BomberFlak 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.19,
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,
)...