Good morning all, I was wondering if VBScript could do the same thing as what the below JavaScript is doing, that is to focus on a form control after the user has made some mistakes in his/her inputs...

<script type="text/javascript">
function Verify_Inputs() {
if(document.Testing_Form.Testing_TextBox.value == "") {
alert("Please enter a value.")
document.Testing_Form.Testing_TextBox.focus();

return false;
} // Ends the If-Clause.

document.Testing_Form.submit();
return true;
} // Ends the "Verify-Inputs" function.
</script>

Recommended Answers

All 4 Replies

it might be possible, but javascript is really the best way to handle it

VBScript has identical form focus syntax as JavaScript, so yes, you can set the focus using client side VBScript. Declare your code block as type="text/VBScript" though. Also, bear in mind that VBScript is only processed by Internet Explorer. No other browser uses VBScript for client side processing.

Also, bear in mind that VBScript is only processed by Internet Explorer. No other browser uses VBScript for client side processing.

Hence my comment that javascript is the way to go

I'm sorry, but I think that you haven't shown me how to do that, or rather the directions in which how I can do that, could you direct me to the right place for it, thanks?

VBScript has identical form focus syntax as JavaScript, so yes, you can set the focus using client side VBScript. Declare your code block as type="text/VBScript" though. Also, bear in mind that VBScript is only processed by Internet Explorer. No other browser uses VBScript for client side processing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.