SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2002
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    function submitit() - not working?

    Can you find anything wrong with the following CODE? It currently does not return to the original page. You are supposed to pull up FILENAME.php and when you vote from that page it just returns you back to it... ANy suggestions?

    DO i need the full path to the php file? I dunno..
    PHP Code:
    ----------
    function 
    submitit() {
         if (
    document.rateform.rate.value=="x"){
            
    alert ("You did not make a Rating");
         }else {
           
    document.rateform.submit(); } }
    -----------
     
       <
    form action="filename.php?avroomid=1" method="post" name="rateform">
       <
    select name="rate" class="text">
       <
    option value="x" selected>Rate Tune!</option>
       <
    option value="5">Excellent</option>
       <
    option value="4">Good</option>
       <
    option value="3">Fair</option>
       <
    option value="2">Poor</option>
       <
    option value="1">Rubish</option>
       </
    select>
      <
    input type="hidden" name="action" value="vote"
      <
    input type="button" value="Rate!" style="font-size:8px" onclick="javascript:submitit()">
       <
    input type="hidden" name="userid" value="2">
       </
    form

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <html>
    <head>
    <script type="text/javascript">
    
    function submitit(oSelect)
    {
    	if (oSelect.selectedIndex == 0)
    	{
    		alert ("You did not make a Rating");
    		return false;
    	}
    	else return true;
    }
    
    </script>
    </head>
    <body>
    <form action="filename.php?avroomid=1" method="post" name="rateform" onsubmit="return submitit(rate)">
    <select name="rate" class="text">
    <option value="x" selected>Rate Tune!</option>
    <option value="5">Excellent</option>
    <option value="4">Good</option>
    <option value="3">Fair</option>
    <option value="2">Poor</option>
    <option value="1">Rubish</option>
    </select>
    <input type="hidden" name="action" value="vote"> 
    <input type="submit" value="Rate!" style="font-size:10px;">
    <input type="hidden" name="userid" value="2">
    </form>
    </body>
    </html>
    ::: certified wild guess :::


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •