Jump to content

Submit() is not a function


Catzwolf

Recommended Posts

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.

[code]
        /**
        * 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 />";
[/code]

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.