Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, August 29, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Check URL Exists
Guy Barrett
Posts: 63
 
Check URL ExistsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Aug 09 8:41 AM
Me again, like a bad penny.

I've created a new form within which users can view product details. In most cases there is an accompanying image for the product stored on our web site.

As such, I've created a button that when clicked opens a web browser and displays the image.

Here's the kicker. I would like to disable the button if the image does not exist, is there any way of checking the URL when the form opens, and disabling the button if the image is not there? I was hoping it would be something simple, like using a hidden TBrowser control, but there are not enough properties open to me in this control to see if a URL has been successful or not. Even reading the HTML value after a successful or unsuccessful URL has loaded to this control only gives me "HTML/HTML".

Anyone feeling creative?
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: Check URL ExistsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Aug 09 8:47 AM
Where are the Images stored? Can you just check on the server side if the Image exists?

Otherwise you may be able to make a call using the xMLHTTP object and then test the Response status (HTML code). If you get a 200, great, otherwise fail.

But... Couldn't you as well try something like "prefetching" the Image and if it exists, enable the button, if it doesn't disable it. And, since you have prefetched it, don't need to open a new browser, could use a Dialog to display it (all with Javascript).
[Reply][Quote]
Guy Barrett
Posts: 63
 
Re: Check URL ExistsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Aug 09 9:42 AM
Thanks for the advice (do you get any work done other than supporting me? )

Unfortunately the actual server itself is hidden to the majority of the Saleslogix users and the Saleslogix Server, the only way in I have is through the URL.

Your xMLHTTP object idea sounds like it could have legs, I'll look up the object properties on Google and try to figure out how to use it.

Prefetching the image would be ideal if a) I could locally store a web page on every users machine that I could pass parameters to which would then run some java and return a value, or b) I had direct access to the website. I've asked the web guys here to create such a page that would return some values that I could read, but they're up to their eyeballs at the mo and refuse to help.

If anyone has a link to some documentation on xMLHTTP I'd be grateful, otherwise I'll see what I can find myself.
[Reply][Quote]
Guy Barrett
Posts: 63
 
Re: Check URL ExistsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Aug 09 10:49 AM
Thanks for the advice, I've managed to cobble something together. For anyone else wanting to do this...

1) Copy this function and either place it in your form script or in a library that it references (preferable, as you can use it again elsewhere)

Function Web_ValidateURL(strURL)

Dim objHTTP
Set objHTTP = CreateObject("Microsoft.XmlHttp")
objHTTP.open "HEAD", strURL, FALSE
objHTTP.send ""

if objHTTP.Status = "200" then
Web_ValidateURL = True
else
Web_ValidateURL = False
end if

set objHTTP = nothing

End Function

2) In the script for your form, or wherever you want to check a URL...

if Web_ValidateURL("http://www.yourwebaddress/yourjpgfolder/xyz.jpg") = True then
btnImages.Enabled = True
btnImages.Caption = "Images"
else
btnImages.Enabled = False
btnImages.Caption = "No Image"
end if

... you will obviously need to change the code to suit your circumstances but hopefully the above is simple enough to understand.

Nice to give something back for a change
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 8/29/2025 10:16:05 AM