DonG2


Howdy Everyone,

Just started playing with Popfly a few days ago. Nice work Popfly Team! It's FUN!

As a wee bit of background ... In the past, I've programmed in COBOL (mini and mainframe systems), BASIC, C (Win32 DLLs), Delphi (Windows); along with some perl and JavaScript (web), C++ (mods to existing code), and even some VB. But I never got very deep into JavaScript/JScript, beyond writing or modifying cutsie scripts for web pages (non-OO); and have done nothing with WPF, Silverlight, XAML or any of the newest web stuff (AJAX). So, I'm an old-but-experienced programmer, but a complete newbie when it comes to Popfly and Silverlight. (Sheesh, my in-line spell checker just had a field day with this paragraph - LOL !)

So far, I've managed to create a mashup and a Popfly web page to run it in (http://www.popfly.ms/users/DonG/EarthExplorer-WebPage), which uses the User Input, GeoNames Worldwide and Virtual Earth blocks. However, I've not been able to figure out how to check data coming out of a block. For example, in the mashup above, if the user types in a Place Name that the GeoNames Worldwide block is unable to decipher into latitude / longitude values, the Virtual Earth block dumps an error message right across the Place Name input control ... "ERROR: virtualEarth's setMapView operation requires a value for latitude, but no value has been given!", which can't seem to be removed, and the user can't see what they typed. Thus, the user is forced to reload the web page so they can see and use the input controls, then retype whatever they typed previously.

So, where and how do I code ...

1) A check of the output from GeoNames Worldwide (or any other block),
before the data is sent to the Virtual Earth block.

2) Display a nice pop-up message to the user which can then be dismissed.

3) Return to the previous block (User Input in this case) to get correct data
from the user, instead of going forward to the Virtual Earth block.

Or, will Popfly eventually display errors like this in a user-dismissable pop-up, without the coder needing to trap errors

Thanks a bunch!





Re: Data Validation/Checking - How To?

DonG2


Nobody is doing data validation







Re: Data Validation/Checking - How To?

RealHeartMozart [msft]

Hi Don,

Neat mashup and web page!

What you're seeing is the results of automatic data validation that Popfly does for all blocks. The validation is done based on the Block Description which you can see if you look at the block in Create a Block. Unfortunately in this case the control that displays any data validation errors is right in the same place as your input control. I think that the best workaround for right now would be to move your input control down on the page. I'd also be happy to hear your suggestion for how to improve this further.

As for the other question about how you could validate the output of geonames and provide a more friendly error message in case it does not find a latititude and longitude, you can do this:

1. Click the wrench on the Virtual Earth block

2. Click on Switch to Advanced view

3. Modify the code that you see to include a check for latitude like this:

pendingCalls["Virtual Earth"] = 1;
if (data["GeoNames Worldwide"].latitude == "")
{

alert("Can't find that place");
} else
{
var result = virtualEarth.setMapView(data["GeoNames Worldwide"].latitude, data["GeoNames Worldwide"].longitude, data["User Input"].value2, "", "", "");
pendingCalls["Virtual Earth"]--;
if (pendingCalls["Virtual Earth"] == 0) environment.finish();
}

4. Click wrench to zoom back out

5. Preview

Let me know how this turns out for you, and whether you have any suggestions on how we could make this easier.

Yours,

Michael







Re: Data Validation/Checking - How To?

DonG2

Howdy Michael,

Thank you for your kind comments about my first <very simple> mashup, and for answering my questions .

Your code example works like a champ, with a nice user-dismissable pop-up error box. Thank you !

> ... any suggestions on how we could make this easier.

You bet! I'll work-up some text off-line and post it later. If you don't see an additional post below this one, please remember to check back, as I WILL be posting one Smile. Thanks for asking!

Relating to a mashup creator having to specify custom HTML, in order to move the Popfly-generated User Data Input area down low enough to allow display space for Popfly-generated Error messages ... I think Popfly should automatically allow space for it's own error messages, don't you <grin> I don't think this should have to be done by us "simpleton" mashup creators.

However, as mentioned elsewhere in the forums (I think) and in my Popfly Feedback e-mail to the Popfly Team ... I think Popfly should replace this "text overlay" form of error notice with a pop-up, user-dismissable, error box ... just like what the JS alert function provides. Thus leaving the currently-rendered web page surface alone -- which means no need for anyone to adjust any page element positions at any time <smile>.

Thanks again Michael!






Re: Data Validation/Checking - How To?

DonG2

Howdy Michael,

Well, my suggestion text got a bit long, and pasting it into the editor here in the forums removed all of the plain-text-file formatting (leading spaces) I had used. So, I sent the text file via e-mail attachment to the e-mail address supplied in your Profile here <name>@messengeruser.com. Hope you get it okay.

EDIT: Well, that didn't work either. Got a 550 error: "no such domain". So, if you could provide me with a human-readable e-mail address, I'd be happy to send you my suggestion in a text file <smile>.

Cheers,






Re: Data Validation/Checking - How To?

RealHeartMozart [msft]

Hi Don,

My email is michleo@microsoft.com. Look forward to seeing your full comments, and thanks for the ones above. Smile

By the way, we try to discourage pop up alerts in general because they tend to be disruptive if anybody else tries to use your mashup. We have seen cases, for example, where somebody embedded several mashups in a blog, and there was some data flow disruption that caused errors in multiple mashups... opening the blog resulted in multiple alerts going off, thereby making it impossible to read the blog. Your mashup doesn't have this problem because it is user input driven, but it's a consideration in general. I'm thinking about how we can better use the error dialog area that already appears (but is overlapping your user input box.)

Yours,

Michael






Re: Data Validation/Checking - How To?

DonG2

Howdy Michael,

Thank you ... just sent my suggestion text file to you. However, it falls more on the data validation side, than on the error reporting side. Oh well, maybe it will provide someone on the team with a good laugh anyway <smile>

Okay, I can see how a mashup with auto-execute/load functions, and pop-up boxes for error display, could be a problem when any part of the auto-load process fails.

The only time the current error handling display area "gets in the way", is when a mashup employs a User Input block of some sort, right Otherwise, when no data entry controls are visible, the existing error display area should be clear and available for error text use.

Thus, only when a mashup contains some type of user-data-input block (hopefully Popfly knows this internally, even when the block name is not "User Input") ... have Popfly reserve an error reporting area (single line ) either above or below where the user-input controls will be displayed (mashup developer choice inside the User Input block ). Or, instead of merely reserving the display area, go ahead and display it, but without any text (as blank). I think of this area being similar to a normal Windows app Status Line.

It would also be helpful if a clickable link of some sort could be provided when an error is actually present, either at the beginning or end of the error text. When clicked, the entire error and any additional information would be displayed to the user. Right now, when the error text is long, a portion of the text is burried under the Popfly Logo display area, located at the upper right corner of a mashup. Thus, this extra link would only need to be provided when the text of the error message is longer than some pre-defined number of characters, leaving enough space for the Popfly Logo area even on a low-resolution screen.

Hope this is useful .






Re: Data Validation/Checking - How To?

DonG2

Howdy Michael,

In the code you suggested ...

Code Snippet

if (data["GeoNames Worldwide"].latitude == "")
{

alert("Can't find that place");
}

... how do I access the user-entered values, that were enter two blocks back

For my example, I would want to clear the "Place Name" value the user had entered. It's input into the GeoNames Worldwide block from the User Input block as "User Input".value1, but this doesn't seem to work in the Virtual Earth block, where the validation is taking place, by using: "User Input".value1 = "" -or- userInput.value1 = "". How should it be accessed

Thank you Michael -- or anyone else <smile>.