Help- Client script calling server side function 
Author Message
 Help- Client script calling server side function

I am using a PageObject in my ASP page and I am trying to call a
server side validation function. I am having problems getting the
return value.
Can anybody help ?

Client Script:

<script Language=VBScript>
sub Form_Validator(downloadlistpost)  

      retObj=thisPage.execute.VerifyBatchID(trim(thisForm.BatchID.value))
      if  retObj.return_value > 0 then
        call msgbox("Batch ID already exists.")
        exit sub
      end if
end sub    
</script>

Server Script:
Function VerifyBatchID(BatchID)
    'ADO call to database
    rs.Open str, cn, adOpenKeyset, , adCmdText
    VerifyBatchID= rs.recordcount
End Function



Tue, 24 Aug 2004 06:01:20 GMT  
 Help- Client script calling server side function
you can't call server-side script from client-side script like this.

go an look on http://www.aspfaqs.com/ category : nature of things.

Atrax - MVP [Microsoft Most Valued Professional]

http://www.infinitemonkeys.ws/

Host with me for $100 a year!
http://www.atrax.ws/hosting/

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Tue, 24 Aug 2004 10:09:21 GMT  
 Help- Client script calling server side function
Thanks for your response.
I looked at the link that you provided.
But I am still having propblems trying to get remote scripting working
with the page object.
Has anybody had success with this?

If this cannot be done, what is the best way to accomplish validation of
user input when a database lookup is required?

That's all I am trying to accomplish now.

Thanks

SL

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Wed, 25 Aug 2004 00:19:49 GMT  
 Help- Client script calling server side function
Have a look at XMLHTTP objects that do the same as remote scripting but
easier, better and faster - IE 5.0 + only though.

Chris.


Quote:
> Thanks for your response.
> I looked at the link that you provided.
> But I am still having propblems trying to get remote scripting working
> with the page object.
> Has anybody had success with this?

> If this cannot be done, what is the best way to accomplish validation of
> user input when a database lookup is required?

> That's all I am trying to accomplish now.

> Thanks

> SL

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Wed, 25 Aug 2004 02:44:30 GMT  
 Help- Client script calling server side function
Also, using a hidden frame can be the easiest solution.

Call an ASP page in a hidden (zero sized) frame and then call a function in
your page from the page that loads in the hidden frame.

Chris.


Quote:
> I am using a PageObject in my ASP page and I am trying to call a
> server side validation function. I am having problems getting the
> return value.
> Can anybody help ?

> Client Script:

> <script Language=VBScript>
> sub Form_Validator(downloadlistpost)

>       retObj=thisPage.execute.VerifyBatchID(trim(thisForm.BatchID.value))
>       if  retObj.return_value > 0 then
>         call msgbox("Batch ID already exists.")
>         exit sub
>       end if
> end sub
> </script>

> Server Script:
> Function VerifyBatchID(BatchID)
>     'ADO call to database
>     rs.Open str, cn, adOpenKeyset, , adCmdText
>     VerifyBatchID= rs.recordcount
> End Function



Wed, 25 Aug 2004 02:45:38 GMT  
 Help- Client script calling server side function
Thanks for your response.
I have since found the problem. I was missing the SET in front of:
SET retObj=thisPage.execute.VerifyBatchID(trim(thisForm.BatchID.value))

The error message was somewhat misleading.
It now works.

Thanks.
SL

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Fri, 27 Aug 2004 22:19:47 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Calling client-side javascript function from server-side vbscript

2. Calling Server Side Script from Client Side Script

3. Call Server Side Script From Client Side Script

4. Calling server-side function from client-side

5. ASP referring to server side variables in client side script

6. Client side and Server side script working together

7. Client-side Subroutine calling Server-Side Subroutine

8. Calling client-side javascript from server-side vbscript

9. Calling server side from client side

10. Client side scripting / server side scripting

11. Calling a server side script function from VBScript

12. Accessing Data generated with client-side script from server-side script

 

 
Powered by phpBB® Forum Software