HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 1st, 2000, 09:43 AM
sparticus sparticus is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2000
Posts: 26 sparticus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I have a select form on a page, and I want it to automatically submit when something is selected. How can I do this without having a submit button (or any button)? I'm working with PHP.

Reply With Quote
  #2  
Old March 1st, 2000, 10:24 AM
TroutMask TroutMask is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2000
Location: Englewood, CO
Posts: 30 TroutMask User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Use javascript.

Here:
<HTML>
<HEAD>
<TITLE>Javascript Auto-Navigate On Select</TITLE>
<SCRIPT LANGUAGE="javascript">
function ChangeCatcher() {
if (whatever.myselector.value == 1) {
window.location = "http://www.hotlinecentral.com";
} else if (whatever.myselector.value == 2) {
window.location = "http://www.hotlinecentral.com/hlsearch.shtml";
} else {
window.location = "http://www.hotlinecentral.com/links.shtml";
}
}
</SCRIPT>
</HEAD>
<BODY>
<FORM name="whatever">
<B>Select a place to go: </B>
<SELECT name="myselector" onchange="ChangeCatcher()">
<OPTION value="0" SELECTED>- Make a Selection -
<OPTION value="1">Hotline Central
<OPTION value="2">Hotline Search
<OPTION value="3">Hotline Links
</SELECT>
</BODY>
</HTML>


Oops. You want the form to submit. Instead of using window.location = "",
use whatever.submit (formname.submit).

Hope that helps...

-TM


[This message has been edited by TroutMask (edited March 01, 2000).]

Reply With Quote
  #3  
Old March 1st, 2000, 10:41 AM
sparticus sparticus is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2000
Posts: 26 sparticus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Will this work since I am dynamically building the select form with PHP?

Reply With Quote
  #4  
Old March 1st, 2000, 03:16 PM
TroutMask TroutMask is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2000
Location: Englewood, CO
Posts: 30 TroutMask User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Yes. You can either embed your PHP code within the HTML or have PHP print out the HTML as I've shown. Remember, PHP is a server-side scripting language while javascript is (primarily) a client-side scripting language.

What this means in this context is that we can have PHP on the server write anything to the browser. The browser then interprets this. So, if we have PHP send javascript to the browser, the browser will interpret the javascript (as it does the HTML) and act accordingly.

With the solution as I've provided, there is no need for PHP unless you've got some additional processing required for something else. This will work in a plain .html file.

-TM


Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > Automatic Select Submissions


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway