Message Boards Message Boards


Does the URL Redirect Example from FormFunction work correctly?

Posted 9 years ago
2 Replies
1 Total Likes

When I tried the first example from FormFunction, Neat Examples it only worked once (for Wikipedia) and after that it always gave an error result (for example on Google or Wolfram Research). The example is:

 FormFunction[{"Website" -> <|"Interpreter" -> "SemanticURL", 
     "Input" -> "Wikipedia"|>}, Composition[HTTPRedirect, First], 
  AppearanceRules -> <|"Title" -> "WebGo!", 
    "Description" -> 
     "Write the name of any website, and we will take you there!", 
    "SubmitLabel" -> "Go!"|>]]

Even after closing the web page, and regenerating the CloudDeploy link, giving a new link, I could only obtain the error page. I could not even obtain the input form.

2 Replies

That was likely a temporary bug with HTTPRedirect. That code seems to be working now. However, I would suggest editing it to use the name of the input variable. I think much easier to read/understand:

 FormFunction[{"Website" -> <|"Interpreter" -> "SemanticURL", "Input" -> "Wikipedia"|>}, 
  HTTPRedirect[#Website] &, 
  AppearanceRules -> <|"Title" -> "WebGo!", 
    "Description" -> "Write the name of any website, and we will take you there!", 
    "SubmitLabel" -> "Go!"|>]]
POSTED BY: Chad Knutson

I tried it with both the link in the docs and a newly-deployed one, and it worked fine. Could you post a picture of the error message?

By the way, I like WebGo. Much catchier than Google, don't you think?

POSTED BY: Jesse Friedman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract