DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2005
    Posts
    9

    Reset the value of a textbox

    Hi,

    I call a function with the onblur and as parameter passing a certain value, like this:
    onblur="CheckNum(this.value)"

    When it appears that within the function the value is wrong I want to set the value to "0", but I have about 100 textboxes in which it can be wrong. How do I manage that ?

    Code of the function is e.g. as follows:

    function CheckNum(value1)
    {
    if (value>=1 && value<=8)
    {
    return true
    }
    else
    {
    return false
    AND NOW the value of the calling textbox should be "0"
    }
    }

    Help is appreciated, rgds Ger.

  2. #2
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    Strictly speaking this is a java forum, not javascript....

    But I think you should call the CheckNum function with the textfield as parameter,
    not its value, like;

    onblur="CheckNum(this)"

    Then you don't have to worry about which field it is.
    eschew obfuscation

  3. #3
    Join Date
    Sep 2005
    Posts
    9
    Hey Sjalle,

    I didnot realise this is JAVA and not JAVASCRIPT, so I won't create a new thread here !
    Anyway... thanks for your help,

    regards from Holland, Ger.

Similar Threads

  1. Assigning a TextBox Control via a Class Property
    By Miles Tones in forum VB Classic
    Replies: 2
    Last Post: 06-30-2005, 12:57 PM
  2. TextBox Protection Level
    By hoyaabanks in forum ASP.NET
    Replies: 2
    Last Post: 06-09-2005, 12:35 PM
  3. thread: heartbeat and reset
    By David Chu in forum .NET
    Replies: 1
    Last Post: 01-09-2003, 05:50 PM
  4. Replies: 0
    Last Post: 03-12-2002, 02:55 PM
  5. Replies: 0
    Last Post: 11-02-2000, 08:54 AM

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
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links