ASP – Differences Between VBScript and JavaScript

Differences Between VBScript and JavaScript

When calling a VBScript or a JavaScript procedure from an ASP file written in VBScript, you can use the “call” keyword followed by the procedure name. If a procedure requires parameters, the parameter list must be enclosed in parentheses when using the “call” keyword. If you omit the “call” keyword, the parameter list must not be enclosed in parentheses. If the procedure has no parameters, the parentheses are optional.

When calling a JavaScript or a VBScript procedure from an ASP file written in JavaScript, always use parentheses after the procedure name.

User Input

The Request object may be used to retrieve user information from forms:

<form method=”get” action=”simpleform.asp”> 

First Name: fname”>

<br />

Last Name: lname”>

<br /><br />

<input type=”submit” value=”Submit”>

</form>

User input can be retrieved in two ways: With Request.QueryString or Request.Form.

Request.QueryString

The Request.QueryString command is used to collect values in a form with method=”get”. Information sent from a form with the GET method is visible to everyone (it will be displayed in the browser’s address bar) and has limits on the amount of information to send.

If a user typed “Bill” and “Gates” in the form example above, the URL sent to the server would look like this:

http://www.w3schools.com/simpleform.asp?fname=Bill&lname=Gates

Assume that the ASP file “simpleform.asp” contains the following script:

<body> 

Welcome

<%

response.write(request.querystring(“fname”))

response.write(” ” & request.querystring(“lname”))

%>

</body>

The browser will display the following in the body of the document:

Welcome Bill Gates

Request.Form

The Request.Form command is used to collect values in a form with method=”post”. Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send.

If a user typed “Bill” and “Gates” in the form example above, the URL sent to the server would look like this:

http://www.w3schools.com/simpleform.asp

Assume that the ASP file “simpleform.asp” contains the following script:

<body> 

Welcome

<%

response.write(request.form(“fname”))

response.write(” ” & request.form(“lname”))

%>

</body>

The browser will display the following in the body of the document:

Welcome Bill Gates

Form Validation

User input should be validated on the browser whenever possible (by client scripts). Browser validation is faster and you reduce the server load.

You should consider using server validation if the user input will be inserted into a database. A good way to validate a form on the server is to post the form to itself, instead of jumping to a different page. The user will then get the error messages on the same page as the form. This makes it easier to discover the error.

Reference : Dilip Kumar Jena ( https://mstechexplore.wordpress.com )

Advertisements

3 thoughts on “ASP – Differences Between VBScript and JavaScript

  1. Aw, this was a really nice post. In concept I wish to put in writing like this moreover – taking time and precise effort to make a very good article… but what can I say… I procrastinate alot and under no circumstances appear to get something done.

    • Thank’s a lot the encouragement of readers of my blog like you makes me more determined to write something good that can help community and save time to do furter deveopment.

  2. I just want to tell you that I’m newbie to blogs and actually loved your web blog. Almost certainly I’m going to bookmark your site . You certainly have awesome writings. Appreciate it for revealing your blog site.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s