How do i call a vb subroutine from a javascript function?

in my code i want to verify if the field is filled or not.if its left black a message pops up but if it is filled it should proceed to submit the form or run the background vb subroutine.

here is my code

<script language="javascript"> 
     function validate() 
            if (document.getElementById("txtbox").value == "")
                 alert("it works");
                              //call a vb routine here
                 return false;

Thank you in advance

Recommended Answers

All 4 Replies

so wots the problem..

create a sub routine function

make that function returns true or false..

call the function in main ...depend on function wot it returns

you can move forward..!

check my code please.i already have the vb sub routine but how can i call it from the javascript.

this is the vb subroutine i want to call in the else block

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

search for __doPostBack
that will fix your problem..

try that case of any problem let me know

Thanx dnanetwork it worked.many thanks.

Be a part of the DaniWeb community

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