Flash Games

 FAQ   Search   Members   Groups   User Control Panel      Login 

It is currently Wed Jan 07, 2009 8:36 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Submitting a form using a rollover
PostPosted: Wed Oct 17, 2007 10:02 pm 
Offline

Joined: Sat Apr 21, 2007 12:03 am
Posts: 31
I have my rollovers working but I cannot find out how to submit an option that a user has selected.
head JS function:
Code:
function doSubmit(){
   document.OptSelVal.UpOption.value.submit();

body:
Code:
<table border="0" cellspacing="0" cellpadding="0">
                  <tr>
                  
                  <td>
                  <form action="<?php echo $SCRIPT_NAME; ?>" method="post" enctype="application/x-www-form-urlencoded" name="OptSelVal" id="formA">
                        Date       Article<br />
                        10-13-07 Article 1<br />
                        09-14-07 Article 2<br />
                        <select name = "UpOption" size="5" class="mine">
                              <?php

                              $query = "select * from articles;";
                              $result=mysql_query($query);
                              
                              ?>
                                                            <?php
                              while($articlerow=mysql_fetch_assoc($result))
                              
                              {
                              
                                          echo " <option value='". $articlerow['primindex'] . "'>". $articlerow['Title'] ."</</option>";
                                             
                              }
                              
                              ?>
                        </select>
                        </td>
                        
                        </tr>
                        
                        <tr>
                              <td><a href="javascript:doSubmit()" onMouseUp="switchImage('Retrieve',0)" onmouseout = "switchImage('Retrieve',0)" onmouseover = "switchImage('Retrieve',1)" onmousedown = "switchImage('Retrieve',2)"><img name="Retrieve" src="images/editBtn_up.jpg" border="0"/></a>
                  </form>
                  </tr>
                  
            </table>

If I use a regular input button everything works fine. But when i try a rollover button using the JS function above nothing seems to happen when submitted.

_________________
best
siege


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 18, 2007 3:26 am 
Offline
50+ Club
User avatar

Joined: Fri Aug 24, 2007 9:38 pm
Posts: 85
Location: hawaii or bust
Your not accessing the form correctly, it should be:


document.forms.OptSelVal.submit();


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 18, 2007 5:21 am 
Offline

Joined: Sat Apr 21, 2007 12:03 am
Posts: 31
Thanks so much for your reply. I tried what you had suggested and that didnt work.... just so you know the typical <input.... tag works just fine... so i know the form can work. any other ideas?

on a side note. my CSS class is not working on the <select... tag. all the other places I use CSS i have no problem. this is the CSS code <script type="text/javascript" src="dropDownLeapYear.js"></script>
Code:
      <style type="text/css">
<!--
.mine {
   background-color: #000044;
   color: #EFE7DF;
   border: 1 solid #6E6650;
   scrollbar-base-color: #FF8000;
}
-->
</style>

_________________
best
siege


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 18, 2007 8:58 am 
Offline
50+ Club
User avatar

Joined: Fri Aug 24, 2007 9:38 pm
Posts: 85
Location: hawaii or bust
I don't know what you mean by submitting an option?

an option element is submitted when the form which contains it is submitted
the option element which is selected is then the selected value of the select list which contains it.

there's no submit method for an option element


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 18, 2007 4:00 pm 
Offline

Joined: Sat Apr 21, 2007 12:03 am
Posts: 31
This is the style form I have....
Go to where it says: HTML Selection Forms
http://www.tizag.com/htmlT/forms.php

Looking at that example, I would like to change the button to a rollover. I am obvously not emailing the selection but rather sending the selection to a php script.

_________________
best
siege


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 18, 2007 10:50 pm 
Offline
50+ Club
User avatar

Joined: Fri Aug 24, 2007 9:38 pm
Posts: 85
Location: hawaii or bust
ok I understand, but what Im saying is the function doSubmit is not coded correctly you are not going to be able to submit a form that way because again the option element does not have a submit method, you need to submit the entire form via it's submit method.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 18, 2007 10:58 pm 
Offline

Joined: Sat Apr 21, 2007 12:03 am
Posts: 31
How do I adjust my code so that I can submit the entire form? for instance the equivilent of this <input type ="submit" name = "Retrieve" value ="Edit">

_________________
best
siege


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 19, 2007 1:25 am 
Offline
50+ Club
User avatar

Joined: Fri Aug 24, 2007 9:38 pm
Posts: 85
Location: hawaii or bust
all you should have to to is change the doSubmit function to submit the form


doSubmit() {
document.forms.formname.submit()
}


and call that function where ever you need it or just call the statement inline in the eventhandler:

onmouseenter = "document.forms.formname.submit()"


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group - Flash Games - TNX Invitation Code - TNX Review

Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User:
Pass:
Log me on automatically each visit: