/    Sign up×
Community /Pin to ProfileBookmark

server control textbox onchange

greetings …

developing using asp.net and c#, we would like to add some java script client side validation:

we have a server text box control where users type information, hit the enter key, whereby server side validation is already being performed.

however, some addt’l functionality is required:

once this server side validation is completed,
we would like a message to appear
(“do you have more information to enter ?”)

if true, setfocus back to text box, where they can type additional information.

if no, run the code on the only submit button on the form.

any ideas ?

regards,
tim

?

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceJun 21.2006 — How is server-side validation performed on a text box without submitting the form?
Copy linkTweet thisAlerts:
@timmerdfwauthorJun 21.2006 — great question,

the form is being submitted for verification:

here is the code thus far:

//Webpage.aspx.cs code:

Page load

{...

this.txtbox.Attributes.Add("onChange", "return confirmSubmit();");

...

}


private void ConfirmSubmit()

{

System.Text.StringBuilder Script = new System.Text.StringBuilder();

Script.Append("<script language='javascript'>");

Script.Append("document.Form1('confirmation').value = confirm('Enter more data?');");

Script.Append(" Submit_Click();");

Script.Append("</script>");

RegisterStartupScript("confirmation", Script.ToString());

}


private void txtbox_TextChanged(object sender, System.EventArgs e)

{

...

user types in some data, then they hit enter,

some server side code going on here etc.

...

ConfirmSubmit();

}


Private void Submit_Click(object sender, System.EventArgs e)

{

...

process server side code & then server.transfer code goes here

...

}


Quirky as it seems, the data must be entered one row at a time this way

(prize verification):

server side validation must first be performed,

then prompt the user to enter more data (set focus back on our text box)

or complete the "prize verification process" (run the submit_click event)

  • - thanks! -

    tim
  • Copy linkTweet thisAlerts:
    @phpnoviceJun 21.2006 — great question,

    the form is being submitted for verification:[/QUOTE]

    What I mean is... From the browser's perspective, what is the difference between the two types of form submissions?
    ×

    Success!

    Help @timmerdfw 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 6.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: @nearjob,
    tipped: article
    amount: 1000 SATS,

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

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,
    )...