[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 189
  • Last Modified:

Displaying form variables

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

0
grantballantyne
Asked:
grantballantyne
  • 2
  • 2
1 Solution
 
brad2575Commented:
you can just do a replace(FormValue, "scottish borders", "")

this will remove the text from the string.
0
 
grantballantyneAuthor 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

0
 
brad2575Commented:
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
0
 
grantballantyneAuthor Commented:
brilliant thanks Brad
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now