Jump to content


Photo

Submit() is not a function


  • Please log in to reply
1 reply to this topic

#1 Catzwolf

Catzwolf
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 08 July 2006 - 07:43 PM

I am not the greatest with JS, to me it doesn't seem to make sense. I am comfortable with Object prgramming but JS is another story.

I have been trying to get a script to work for the last few days, I keep getting the same error and the script refuses to work.

The error is submit() is not a function.

        /**
         * Start of User Output
         */
        xoops_cp_header();
        xoops_admin_menu( $tblColors, '', _AM_FINDUS, $op );
        echo "<div><b>" . _AM_RESULTS . "</b></div><br />";
        if ( $total == 0 ) {
            echo "<h4>" . _AM_NOFOUND, "</h4>";
        } elseif ( $start < $total ) {
            echo sprintf( _AM_USERSFOUND, $total ) . "<br /><br />";
            echo "
			<form action='admin.php' method='post' name='memberslist' id='memberslist'>
			 <input type='hidden' name='op' value='delete_many' />
			  <table width='100%' border='0' cellspacing='1' cellpadding='2' class='outer'>
			   <tr align='center'>
			    <th>
				 <input type='checkbox' name='memberslist_checkall' id='memberslist_checkall' onclick='xoopsCheckAll(\"memberslist\", \"memberslist_checkall\");' />
				</th>
			    <th>" . _AM_UNAME . "</th>
			    <th>" . _AM_RANK . "</th>
			    <th>" . _AM_REGDATE . "</th>
			    <th>" . _AM_LASTLOGIN . "</th>
			    <th>" . _AM_POSTS . "</th>
			    <th>&nbsp;</th>
			   </tr>";

            foreach ( array_keys( $foundusers ) as $j ) {
                $class = ( $ucount % 2 == 0 ) ? 'even' : 'odd';
                $ucount++;
                $fuid = $foundusers[$j]->getVar( "uid" );
                $funame = $foundusers[$j]->getVar( "uname" );
                $fuser_name = $foundusers[$j]->getVar( "name" ) ? $foundusers[$j]->getVar( "name" ) : "&nbsp;";
                $funame_linked = $foundusers[$j]->getUnameFromId();
                $last_login = $foundusers[$j]->getTimeStamp( null . 'last_login' );
                $user_regdate = $foundusers[$j]->getTimeStamp( null . 'user_regdate' );
                $rank = $foundusers[$j]->rank( true );

                echo "		
				<tr align='center'>
				 <td class='head'>
				 	<input type='checkbox' name='memberslist_id[]' id='memberslist_id[]' value='" . $fuid . "' />
				 	<input type='hidden' name='memberslist_uname[" . $fuid . "]' id='memberslist_uname[]' value='" . $funame . "' />
				 </td>
				 <td class='even'>" . $funame_linked . "</td>
				 <td class='even'>" . $rank . "</td>
				 <td class='even'>" . $user_regdate . "</td>
				 <td class='even'>" . $last_login . "</td>
				 <td class='even'>" . $foundusers[$j]->getVar( "posts" ) . "</td>
				 <td class='even'>
				   <a href='" . $_PHP_SELF . "?fct=users&amp;uid=" . $fuid . "&op=edituser'>" . xoops_img_show( 'edit', _EDIT, 'middle' ) . "</a>
				   <a href='" . $_PHP_SELF . "?fct=users&amp;uid=" . $fuid . "&amp;op=deluser'>" . xoops_img_show( 'delete', _DELETE, 'middle' ) . "</a>
				   <a href='" . $_PHP_SELF . "?fct=mailusers&amp;uid=" . $fuid . "&amp;type=0'>" . xoops_img_show( 'pmmailtot', _AM_SENDEMAIL, 'middle' ) . "</a>
				 </td>
				</tr>\n";
            } 

            $group_array = array();
            $this_array = array( 'users' => _DELETE, 'mailusers' => _AM_SENDMAIL );
            if ( $group > 0 ) {
                $add2group = &$member_handler->getGroup( $group );
                $group_array = array( 'groups' => sprintf( _AM_ADD2GROUP, $add2group->getVar( 'name' ) ) );
            } 
            $total_array = array_merge( $this_array, $group_array );

            echo "
			<tr class='foot'>
			 <td>";
            
			xoops_getSelection( $total_array, 'users', 'fct' );
            echo "</td>";
            if ( $group > 0 ) {
                echo "<input type='hidden' name='groupid' value='" . $group . "' />";
            } 
            echo "
		   	   <td colspan='10'><input type='submit' value='" . _SAVE . "' /></td>
			  </tr>
			 </table>
			</form>\n";
			/*
			* JS to display page navigation. This part doesn't seem to work as expected
			*/  
            $totalpages = ceil( $total / $limit );
            if ( $totalpages > 1 ) {
                $hiddenform = "<form name='findnext' action='admin.php' method='post'><input type='hidden' name='op' value='findusers' />";
                foreach ( $_POST as $k => $v ) {
                    $hiddenform .= "<input type='hidden' name='$k' value='" . $myts->stripSlashesGPC( $v ) . "' />\n";
                } 
                if ( !isset( $_POST['limit'] ) ) {
                    $hiddenform .= "<input type='hidden' name='limit' value='" . $limit . "' />\n";
                } 
                if ( !isset( $_POST['start'] ) ) {
                    $hiddenform .= "<input type='hidden' name='start' value='" . $start . "' />\n";
                } 
                $prev = $start - $limit;
                if ( $start - $limit >= 0 ) {
                    $hiddenform .= "<a href='#0' onclick='javascript:document.findnext.start.value=" . $prev . ";document.findnext.submit();'>" . _AM_PREVIOUS . "</a>&nbsp;\n";
                } 
                $counter = 1;
                $currentpage = ( $start + $limit ) / $limit;
                while ( $counter <= $totalpages ) {
                    if ( $counter == $currentpage ) {
                        $hiddenform .= "<b>" . $counter . "</b> ";
                    } elseif ( ( $counter > $currentpage-4 && $counter < $currentpage + 4 ) || $counter == 1 || $counter == $totalpages ) {
                        if ( $counter == $totalpages && $currentpage < $totalpages-4 ) {
                            $hiddenform .= "... ";
                        } 
                        $hiddenform .= "<a href='#" . $counter . "' onclick='javascript:document.findnext.start.value=" . ( $counter-1 ) * $limit . ";document.findnext.submit();'>" . $counter . "</a> ";
                        if ( $counter == 1 && $currentpage > 5 ) {
                            $hiddenform .= "... ";
                        } 
                    } 
                    $counter++;
                } 
                $next = $start + $limit;
                if ( $total > $next ) {
                    $hiddenform .= "&nbsp;<a href='#" . $total . "' onclick='javascript:document.findnext.start.value=" . $next . ";document.findnext.submit();'>" . _AM_NEXT . "</a>\n";
                } 
                $hiddenform .= "</form>";
                echo "<div style='text-align:center'>Users: " . $hiddenform . "</div><br />";

The script is to show users via a form, depending on certain criteria (Top half of the script is for display output) and this works as it should.

There is a page navigation which is the second part, this uses JS to control which 'page' is selected and shown. This is the part that is giving me the error. If I click on the next page I get the above error.

I thought this might have been due to me naming a button 'submit' but it still doesn't work.

Any help would be great,

Thanks

#2 emehrkay

emehrkay
  • Staff Alumni
  • Advanced Member
  • 1,214 posts

Posted 15 July 2006 - 01:25 AM

you might have more than one thing named submit on the form




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users