/    Sign up×
Community /Pin to ProfileBookmark

Validation-alert if over a certain value

I have the following text box:

[code]<input type=text id=dblNetWeight<%=intX%> name=dblNetWeight<%=intX%> style=”font-size: 8pt” value=”<%=intNetWeight%>” onChange=”RecalculateGrossWeight()” size=”20″></td>
[/code]

I wish to raise an alert if the value is over 1000000 in size. Normatlly i would create a function for this, but as you see the ID of the field is driven by an asp integer…so I can’t call the field. So, I need to put the function directly on the box itself…any ideas? Thanks!

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@KorMay 09.2006 — 
  • - you don't need the id, you may use the self reference [B]this[/B]


  • onchange="Number(this.value)>1000000?alert('Max value allowed is 1000000'):RecalculateGrossWeight()"
    Copy linkTweet thisAlerts:
    @dzirkelbauthorMay 09.2006 — that seems to work perfectlyl...thanks!
    ×

    Success!

    Help @dzirkelb spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.17,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...