Jump to content
Server Maintenance This Week. ×

house search using maximum and minimum price


This topic is 8463 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I want to create a search page. On this page I want people to select the minimum price they want to pay for a house and the maximum price. (using to value lists). The results have to be the houses that have a price in between these min. an max price.

In the database i have fields of adres and price for the houses. I am using fm4.1

Any one got any sollutions?

Link to comment
Share on other sites

Try this:

if a form has more than one input for the the same field, Web Companion joins them all up when the form is submitted.

So put a text input for houiseprice marked on the form as being "lowest price" then a hidden input with "..." then another input field marked on the form as "highest price" and hopefully when submitted FMP will see "$$$...$$$" which should work.

Link to comment
Share on other sites

That seems to work nicely. but it creates a different problem.

Now it is possible to select a minimum price that is higher than the maximum price (or max lower than minimum)!!! And this is incorrect!

How can i fix this problem?

Any one know a javascript that can validate that the minimum price is lower than the maximum price? I am using value list to select the min and max price.

Link to comment
Share on other sites

Paste this into an html editor and try it out! The value attribute doesn't work for popups/dropdowns with netscape (selectedIndex) but does work for text fields

This will stop the submision of the form and return with the offending textbox selected

It's very simple and should start you on your way to playing with JS (i've made it so you will have to change some things it does work though!)

I hope this gets you going

<html>

<head>

<title>Untitled Document</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

<script language="JAVASCRIPT"><!--

function dodgyPrice(priceForm) {

if (priceForm.textlowvaluename.value >= priceForm.texthighvaluename.value){alert("bunch of arse the lower price is higher than the higher one!!!")

priceForm.textlowvaluename.focus()

priceForm.textlowvaluename.select()

return false

}

}

//-->

</script>

<body bgcolor="#FFFFFF">

<form name="priceForm" action="do it" method="Post" onsubmit="return dodgyPrice(priceForm)">

low price

<input type="text" name="textlowvaluename" value="4">

high price

<input type="text" name="texthighvaluename" value="1">

<input type=submit name="submit" value="hmmmm"></form></body>

</html>

Link to comment
Share on other sites

Have a go with this one

scratchmalogicalwax

<html>

<head>

<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">

<title>Untitled Document</title>

</head>

<script language="JAVASCRIPT"><!--

function dodgyPrice(priceForm) {

if (priceForm.poplowvaluename.selectedIndex >= priceForm.pophighvaluename.selectedIndex){alert("bunch of arse the lower price is higher than the higher one!!!")

priceForm.poplowvaluename.focus()

return false

}

}

//-->

</script>

<body bgcolor="white">

<form name="priceForm" action="file:///Macintosh/Temporary%20Items/do it" method="Post" onsubmit="return dodgyPrice(priceForm)">

low price <select name="poplowvaluename" size="1">

<option value="1000">1000

<option value="2000">2000

<option value="3000">3000

</select><input type="hidden" name="dots" value="...."> high price <select size="1" name="pophighvaluename">

<option value="1000">1000

<option value="2000">2000

<option value="3000">3000

</select><input type="submit" name="submit" value="hmmmm">

</form>

</body>

</html>

Link to comment
Share on other sites

Thx for ur help, but i am still not able to get it going the way i want it.

I want to select the min_price and max_price (or type it in textfields).

then the field price should be like this:

"min_price...max_price". THis way all the houses should be find within the range. But i want to be able to also search on province and city.

If the form is filled in incorretcly i want to stop submitting and showing the alert message!!!

Link to comment
Share on other sites

Have a go with this.....you have to change names of fields to mach those in your database and add some more but the value....value thing you wanted is there.

You don't have to do it all on one page though you could show them all the houses in their price range and then let them focus in...anyway I hope it helps.

Scratch

NB You can do this with dropdowns but it's a pain because netscape doesn't recognise the value attribute of dropdowns (returns NULL) it uses selectedIndex which is useless when your trying to move the value!

<html>

<head>

<title>Untitled Document</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

<script language="JAVASCRIPT"><!--

function dodgyPrice(priceForm) {

if (priceForm.textlowvaluename.value >= priceForm.texthighvaluename.value){alert("bunch of arse the lower price is higher than the higher one!!!")

priceForm.textlowvaluename.focus()

priceForm.textlowvaluename.select()

return false

}

}

//-->

</script>

<body bgcolor="#FFFFFF">

<form name="priceForm" method="Post" >

low price

<input type="text" name="textlowvaluename" value="4">

<input type="hidden" name="dots" value="....">

high price

<input type="text" name="texthighvaluename" value="1">

</form>

<!--two forms to stop you searching on the values and field names of the first-->

<form name="priceForm1" action="FMPro" method="Post" onsubmit="return dodgyPrice(priceForm)">

<!--change queryfield type to hidden it is text to show you it working you also want to add your location and whatever fields here adding a -LOP "AND" hidden field

before all the fields your searching on and an -OP "eq" field before EACH of the search fields -->

<input type="text" name="queryfield">

<!--change the submit name to name="-Find" (i'm assuming your using WC not lasso & WC) don't worry about the queryfield value not appering to change when you click submit ..it does, click back and you'll see-->

<input type="submit" name="button" value="hmmmm" onClick="priceForm1.queryfield.value=priceForm.textlowvaluename.value + priceForm.dots.value + priceForm.texthighvaluename.value;">

</form>

</body>

</html>

Link to comment
Share on other sites

This topic is 8463 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.