Displaying form variables

Posted on 2009-02-12
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.

<select name="radius" id="radius" onclick="document.form2.pPostcode.value  ;usePointFromPostcode(document.getElementById('pPostCode').value += ' scottish borders',

    function (point) {;



                <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>


Open in new window

Question by:grantballantyne
    LVL 16

    Expert Comment

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

    this will remove the text from the string.

    Author Comment

    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

    LVL 16

    Accepted Solution

    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

    Author Closing Comment

    brilliant thanks Brad

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
    Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now