Pass data from toolbar text box to URL in new tab

Add-in Express™ Support Service
That's what is more important than anything else

Pass data from toolbar text box to URL in new tab
 
Kevin Belanger




Posts: 1
Joined: 2015-06-08
I would like to create an IE toolbar which contains two text boxes and two corresponding buttons.

In the first text box, I would like the user to be able to enter a five digit project number and after they hit the submit button I would like that number added to the end of a base URL, so that if the user enters 12345 it would be added to the end of an address formatted akin to http://server/directory so that -in this case- the new tab would open to http://server/directory/12345

In the second text box, I would like the user to be able to enter search terms that would be based to a search page with a base URL akin to http://server/searchcentre/Pages/results.aspx#k= so that if the user typed in Bob Jones and hit submit, a new tab would open to
http://server/searchcentre/Pages/results.aspx#k=Bob Jones

I have created a toolbar with text boxes and buttons, but I am completely new to development of this type, and so I would please for guidance in how to pass the data entered into the respective text boxes to be appended to URLs in a new tab after the user clicks the associated submit button. I have looked in the downloaded documentation and through the forums, but I have not been able to find such information yet, so any help would be greatly appreciated.

Thank you.
Posted 08 Jun, 2015 19:02:40 Top
Andrei Smolin


Add-in Express team


Posts: 14108
Joined: 2006-05-11
Hello Kevin,

In the Click event of the Submit button, you need to construct the URL by concatenating the constant part and the project number entered. Then you use the code we published at https://www.add-in-express.com/forum/read.php?FID=5&TID=3738 to open the project page in a new tab (use any free CSharp to VB.NET code converter available online).

You use the same approach to open the second url. Still, you need to HTML-encode the search term supplied, pleas see e.g. http://stackoverflow.com/questions/8840292/converting-symbol-characters-to-html-with-vb-net.

To get the text entered in a text box you use the TextBox.Text property, see https://msdn.microsoft.com/en-us/library/a19tt6sk%28v=vs.110%29.aspx.
On concatenating strings, see https://msdn.microsoft.com/en-us/library/te2585xw.aspx.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 09 Jun, 2015 04:34:26 Top