SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    need a reminder (javascript)

    I need to detect a whether a persons wrote in a textbox. This dont work, can someone remind me quickly please

    Code:
    if (document.users.updateUser.onchange())
    			{
    			alert ('changed');
    			}
    			else
    			{
    			setTimeout('window.status="' + document.users.updateUser.value + '"',1000);
    			}
    thanks

  2. #2
    SitePoint Addict Caterwomtious's Avatar
    Join Date
    Dec 2001
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <input type="text" onblur="if(this.value == ''){alert('empty')}else{alert('filled in')}" />

  3. #3
    SitePoint Enthusiast jsegura's Avatar
    Join Date
    Feb 2002
    Location
    Barcelona (Catalonia-Spain)
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    I think it's simple

    I think is enough to do this

    <HTML>
    ...
    function whenChanged()
    {
    window.status=document.users.updateUser.value
    //here other things done when changed
    }

    <form name="users"...
    <input type="text" onChange="whenChanged()">
    </form>
    ...
    </HTML>

    Regards,
    Juan.

  4. #4
    What? Maelstrom's Avatar
    Join Date
    Oct 2001
    Location
    Whistler BC originally from Guelph Ontario
    Posts
    2,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you want to do this as a live catch. Meaning the second they start typing you capture it and relay the information to the status bar. Or is it as easy as onchange. I was going respond easlier but I thought it was more complex than a simple onchange.
    Maelstrom Personal - Apparition Visions
    Development - PhP || Mysql || Zend || Devshed
    Unix - FreeBSD || FreeBsdForums || Man Pages
    They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.

  5. #5
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i need to capture it in the function to cancel the Timeout or should i just recall the function?. It's just annoying if the user starts to fill the form out and the function clears the text box, so they have to retype.

    thanks for the help so far.

    PHP Code:
    <!-- ini setup file -->

    <?
        
    include("ini.php3");
        
    pageheader('ini setup file')

    ?>

    <script>
    function openPanel(option)
    {
        var adminpanel = open(option,'adminpanel','');
        adminpanel.focus();
    }

    function verifyUserCheck()
    {
        if (document.users.checkUser.checked==1)
        {
            if(document.users.updateUser.value=="" || document.users.verifyUser.value=="")
            {
                document.users.updateUser.value="Enter Username to ";
                document.users.verifyUser.value="change username";
                setTimeout('document.users.checkUser.checked=0;document.users.updateUser.value="";document.users.verifyUser.value="";document.users.updateUser.focus();',1000);
                window.status=(document.users.updateUser.value + document.users.verifyUser.value);
                [COLOR=blue]if (document.users.updateUser.onchange())
                {
                alert ('changed');
                }
                else
                {
                setTimeout('window.status="' + document.users.updateUser.value + '"',1000);
                }[/COLOR]
            }
            else if (document.users.updateUser.value=="Enter Username to " || document.users.verifyUser.value=="change username")
            {
                setTimeout('document.users.checkUser.checked=0',1000);
            }
            else if (document.users.updateUser.value!=document.users.verifyUser.value)
            {
                if (document.users.updateUser.value)
                setTimeout('document.users.checkUser.checked=0',1000);
            }
            else
            {
                setTimeout('document.users.checkUser.checked=0',1000);
            }
            
        }
        else
        {
            setTimeout('document.users.checkUser.checked=0',5000);
        }
    }
    </script>

    <body bgcolor='#FFFFFF' text='#FFFFFF' link='#000000' vlink='#000000' alink='#000000' topmargin='0' leftmargin='0'>
    <div align="center">
      <form name="users" method="post" action="">
        <table width="366" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
          <tr> 
            <td valign="middle" height="26" colspan="8" align="center" bgcolor="#000000">ini 
              setup file</td>
          </tr>
          <tr> 
            <td valign="top" height="19" colspan="8" align="center"> 
              <p><font color="#000000">Modify Setup</font></p>
            </td>
          </tr>
          <tr> 
            <td valign="top" height="19" colspan="3" bgcolor="#333333"> 
              <div align="center"><font color="#FFFFFF">description</font></div>
            </td>
            <td valign="middle" colspan="4" align="center" bgcolor="#333333"><font color="#FFFFFF">details</font></td>
            <td width="63" valign="top" bgcolor="#333333"> 
              <div align="center"><font color="#FFFFFF">update</font></div>
            </td>
          </tr>
          <tr> 
            <td valign="middle" height="28" align="left" bgcolor="#CCCCCC" colspan="3"> 
              <div align="left"><font color="#000000">Update Username</font></div>
            </td>
            <td valign="top" bgcolor="#CCCCCC" align="center" colspan="4"> <font color="#000000"> 
              <input type="text" name="updateUser" onchange='document.users.updateUser.value=document.users.updateUser.value'>
              </font> <font color="#000000"> </font> <font color="#000000"> </font></td>
            <td valign="top" bgcolor="#CCCCCC">&nbsp;</td>
          </tr>
          <tr> 
            <td height="28" valign="middle" colspan="3" align="left"> 
              <div align="left"><font color="#000000">Verify</font> <font color="#000000">Username</font></div>
            </td>
            <td valign="top" colspan="4"> 
              <div align="center"><font color="#000000"> 
                <input type="text" name="verifyUser">
                </font></div>
            </td>
            <td valign="top"> 
              <div align="center"> 
                <input type="checkbox" name="checkUser" onclick="verifyUserCheck()">
              </div>
            </td>
          </tr>
          <tr> 
            <td height="28" valign="middle" align="left" bgcolor="#999999" colspan="3"> 
              <div align="left"><font color="#000000">Update Password</font></div>
            </td>
            <td valign="top" bgcolor="#999999" align="center" colspan="4"><font color="#000000"> 
              <input type="password" name="updatePass">
              </font></td>
            <td valign="top" bgcolor="#999999"> 
              <div align="center"></div>
            </td>
          </tr>
          <tr> 
            <td height="28" valign="middle" colspan="3" align="left"> 
              <div align="left"><font color="#000000">Verify Password</font></div>
            </td>
            <td valign="top" colspan="4"> 
              <div align="center"><font color="#000000"> 
                <input type="password" name="verifyPass">
                </font></div>
            </td>
            <td valign="top" align="center"> 
              <input type="checkbox" name="checkPass">
            </td>
          </tr>
          <tr> 
            <td height="21" valign="middle" colspan="8" bgcolor="#CCCCCC" align="center"> 
              <hr>
            </td>
          </tr>
          <tr> 
            <td height="19" valign="top" colspan="2"> 
              <div align="center"> <font color="#000000"> <b> <a href="javascript:void(0)" style="text-decoration:none" onclick="openPanel('pass.htm')">admin 
                panel</a> </b> </font> </div>
            </td>
            <td valign="top" colspan="2"> 
              <div align="center"> <a href="javascript:void(0)" style="text-decoration:none" onclick="openPanel('pass.htm')"> 
                <font color="#009933">New admin </font> </a> </div>
            </td>
            <td valign="top" colspan="2"> 
              <div align="center"> <a href="javascript:void(0)" style="text-decoration:none" onclick="openPanel('pass.htm')"> 
                <font color="#0000FF">Edit admin </font> </a> </div>
            </td>
            <td valign="top" width="65"> 
              <div align="center"> <a href="javascript:void(0)" style="text-decoration:none" onclick="openPanel('pass.htm')"> 
                <font color="#9900FF">List admin </font> </a> </div>
            </td>
            <td valign="top"> 
              <div align="center"> <a href="javascript:void(0)" style="text-decoration:none" onclick="openPanel('pass.htm')"> 
                <font color="#FF0000">Remove</font> </a> </div>
            </td>
          </tr>
          <tr> 
            <td height="21" colspan="8" valign="middle" bgcolor="#CCCCCC" align="center"> 
              <hr>
            </td>
          </tr>
          <tr> 
            <td height="13" width="78"></td>
            <td width="20"></td>
            <td width="23"></td>
            <td width="52"></td>
            <td width="48"></td>
            <td width="17"></td>
            <td></td>
            <td></td>
          </tr>
        </table>
      </form>
    </div>
    <p align="center"><font color="#000000">// settings </font> </p>
    <p align="center"><font color="#000000">$dbhost ='localhost';<br>
      $dbuser ='';<br>
      $dbpassword ='';<br>
      $db ='forum';</font></p>
    <p align="center"><font color="#000000">// table names</font></p>
    <p align="center"><font color="#000000">$topics ='topics';<br>
      $replies ='replies';<br>
      $users ='users';<br>
      $management ='admin';</font></p>
    <p align="center"><font color="#000000">// globals</font></p>
    <p align="center"><font color="#000000">$sitename ='forum';<br>
      $dbversion ='1.0';<br>
      $DOMAIN_URL ='../';</font></p>
    <p align="center"><font color="#000000">// forum settings</font></p>
    <p align="center"><font color="#000000">$db_entries ='5';<br>
      $db_display_type ='forum';<br>
      $db_email ='false';<br>
      $url ='./index.php3';</font></p>
    <p align="center"><font color="#000000">// meta settings</font></p>
    <p align="center"><font color="#000000">$author ='Andrew Johnstone';<br>
      $smarttags ='true';<br>
      $keyword ='';<br>
      $description ='';<br>
      $rating ='general';<br>
      $robots ='index,follow';<br>
      $revisit ='';<br>
      $copyright ='';</font></p>
    <p align="center"><font color="#000000">$contentstyle ='';<br>
      $contenttype ='';<br>
      $expires ='';<br>
      $pragma ='no-cache';<br>
      $cache ='no-cache';<br>
      $imagetoolbar ='';</font></p>
    <p align="center"><font color="#000000"><br>
      // page settings</font></p>
    <p align="center"><font color="#000000">$title ='forum';<br>
      $delay ='2';<br>
      $db_css ='style.css';<br>
      $db_tablewidth ='55%';<br>
      $body_attributes ='';<br>
      $signature ='Created by Andrew Johnstone';</font></p>
    Last edited by Andrew-J2000; Mar 9, 2002 at 01:00.


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
  •