We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

Displaying form variables

grantballantyne
on
Medium Priority
199 Views
Last Modified: 2012-06-27
Dear Experts

I have a search form with a form field 'radius' which upon selection populates a couple of hidden form fields with data.  Upon selection of the radius form field it also appends the words 'scottish borders' to an earlier form field called pPostCode - see code below.

I am displaying the pPostCode form value on the results page but would like to display the value without the words 'scottish borders'.

Can anyone advise if this is possible.

Please see link below to the website - if you enter the word 'kelso' into the Area field it will return some results.
http://www.bspc.co.uk/indexradius.asp

<select name="radius" id="radius" onclick="document.form2.pPostcode.value  ;usePointFromPostcode(document.getElementById('pPostCode').value += ' scottish borders',
    function (point) {
      document.form2.Lat1.value=point.lat();
      document.form2.Lon1.value=-point.lng();
      })">
                <option value="0">Select </option>
                <option value="0.5">1/2 mile </option>
                <option value="1">1 mile</option>
                <option value="2">2 miles</option>
                <option value="3">3 miles</option>
                <option value="4">4 miles</option>
                <option value="5">5 miles</option>
                <option value="10">10 miles</option>
                <option value="15">15 miles</option>
                <option value="20">20 miles</option>
                <option value="30">30 miles</option>
                <option value="40">40 miles</option>
                <option value="50">50 miles</option>
                <option value="9999">Anywhere</option>
                            </select>

Open in new window

Comment
Watch Question

Commented:
you can just do a replace(FormValue, "scottish borders", "")

this will remove the text from the string.

Author

Commented:
Thanks Brad

The code below represents me displaying the form field pPostCode on the results page.  Can you advise on how I use your suggestion within this code to eliminate the text 'scottish borders'

Thanks again
Distance from <%= UCase(Request.Form(RTRIM("pPostcode"))) %><strong><%= UCase(Request.QueryString(RTRIM("pPostcode"))) %></strong>: &nbsp;<%= FormatNumber((propertyresults.Fields.Item("").Value), 2, -2, -2, -2) %> miles

Open in new window

Commented:
this should do it for you.

Distance from <%= replace(UCase(Request.Form(RTRIM("pPostcode"))), "scottish borders", "") %><strong><%= replace(UCase(Request.Form(RTRIM("pPostcode"))), "scottish borders", "") %></strong>:  <%= FormatNumber((propertyresults.Fields.Item("").Value), 2, -2, -2, -2) %> miles

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
brilliant thanks Brad
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.