< Back

Document Subject: @urlopen And Javascript
Hint Short Cut: Add this to your code & documentation to help you find this page.
http://#UrlopenJS or http://A555F9/nn.nsf/ByAlias/UrlopenJS

I have seen some developers call javascript direct from @urlopen.


It looks messy but I got this to work.

It basically opens up the settings document if they exist otherwise displays a javascript alert.

r:=@DbColumn(""""Settings"4);
thisdb:=@ReplaceSubstring(@ReplaceSubstring(@Subset(@DbName; -1);" ""+");"\\""/");

@If(@IsError(r);
 @Do(
   @SetTargetFrame("_self");@URLOpen("javascript:alert( 'NoSettings created.');history.back(-1);")

  );

  @URLOpen("/" + thisdb + "/Settings/"+@Subset(r;1)+"?editdocument&login")

)

I suspect a better way would be to call a JS function.

Put this in Action Hotspot instead of similar @SetTarget...:

@SetTargetFrame("_self");@URLOpen("javascript:ShowAlert( 'No Settings created.');")

Put this in JSHeader (Web):

function ShowAlert(sMessage) {
alert(sMessage)
}