close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

display dropdown selection in another area of same form

Thread began 8/28/2014 12:58 pm by Jason | Last modified 8/28/2014 2:38 pm by Jason | 811 views | 4 replies |

Jason

display dropdown selection in another area of same form

What's the best way to display the selection of my dropdown select list in another region of the same form.
I'm populating the list from a mysql database using the MySQLi Server Behaviors.

Here's the code for the dropdown list:

<select name="RecurType" onchange="toggleRecurOn(this.options[this.selectedIndex].value);">
<?php
while(!$RecurType->atEnd()) {
?>
<option value="<?php echo($RecurType->getColumnVal("value")); ?>" selected="selected"><?php echo($RecurType->getColumnVal("text")); ?></option>
<?php
$RecurType->moveNext();
}
$RecurType->moveFirst(); //return RS to first record
?>
</select>



Completely unrelated, but there's no option for MySQLi Server Behaviors in the "Ask A Question" choices for posting a new thread.

Sign in to reply to this post

Jason ByrnesWebAssist

add an ID to the select tag and another onchange function:

<select name="RecurType" id="RecurType" onchange="toggleRecurOn(this.options[this.selectedIndex].value);showSelection();">



add a span to show the selection:

<span id="selectionSpan"></span>



define the onchange event:

<script type="text/javascript">
function showSelection() {
var theList = document.getElementById("RecurType");
var theSelection = theList.options[theList.selectedIndex].value;
var theSelectionSpan = document.getElementById("selectionSpan");
theSelectionSpan.innerHTML = "you Slected: "+theSelection+"";
}
</script>
Sign in to reply to this post

Jason

Is there anyway to have it display whatever the dropdown has selected by default when the page loads?

Right now the span doesn't display anything when the page first opens, even though there is already a choice selected in the dropdown list. Once I change the selection in the dropdown the span displays the text (I'm assuming because of the onchange function).

Sign in to reply to this post

Jason ByrnesWebAssist

no, you should add an empty option to force a selection:
<option value="">Make A Selection</option>

no i did not update anything else.

Sign in to reply to this post

Jason

Ok. Thank you!

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...