Skip to main content
Inspiring
November 18, 2009
Question

Glitch with radio buttons

  • November 18, 2009
  • 1 reply
  • 410 views

Hope someone can help with this.

Basically I did a site a year or so ago, that was all working fine.

However, they changed the hosting, moved all the files across, and exported the database.

Somewhere along the way, a few glitches cropped up - for example the search results page going AWOL, and some SQL error messages cropping up.

So I've been trying to get them to sort it, and am now having to look at the site again myself.

I've got one glitch outstanding - on the page here :

http://www.mph.uk.com/index.php

There's a basic search on the right hand side - where users can select cars or vans as well as a make of vehicle.

The problem is that the radio buttons don't seem to work - if one is checked, and you try to check the other one, they both end up checked instead of swapping.

I'm sure this worked when it was originally done - any ideas what's gone wrong now?

Many thanks!

This topic has been closed for replies.

1 reply

Inspiring
November 18, 2009

OK - bit confused trying to remember how this should go now.

The radio buttons were originally :

<input type="radio" name="VehicleType" value="Car" id="VehicleType_0" class="tickbox"/>

and

<input type="radio" name="VehicleType2" value="Van" id="VehicleType_1" class="tickbox"/>

With this code on the results page that references them :

  $WADbSearch1->addComparisonFromCheck("Category","VehicleType","Car","","AND","=","=",0);

  $WADbSearch1->addComparisonFromCheck("Category","VehicleType2","Van","","AND","=","=",0);

Which I'm sure worked when I did it originally.

So going back to first principles, I made the name of each radio button the same ("VehicleType"), and that fixed them so that they at least changed when each is selected.

But the search isn't working - it only returns cars, but not vans.

So I'm trying to get there, but not quite yet - so if anyone has any ideas that would be good.

David_Powers
Inspiring
November 19, 2009

Iain71 wrote:

So going back to first principles, I made the name of each radio button the same ("VehicleType"), and that fixed them so that they at least changed when each is selected.

But the search isn't working - it only returns cars, but not vans.

That's correct, the name of all radio buttons in a group must be the same. That's how the browser knows they must be treated as being mutually exclusive.

  $WADbSearch1->addComparisonFromCheck("Category","VehicleType","Car","","AND","= ","=",0);

  $WADbSearch1->addComparisonFromCheck("Category","VehicleType2","Van","","AND"," =","=",0);

Judging from the name of the variable, it looks as though you're using a WebAssist extension. Your best bet is to ask in the WebAssist forum. Just looking at the code, you would also need to change VehicleType2 to VehicleType.

Inspiring
November 23, 2009

Thanks David - it was web assist, and I did get it sorted over there.

The second bit of code on the results page needed to be the single line :

$WADbSearch1->addComparisonFromEdit("Category","VehicleType","AND","=",0);

I'm completely confused though, as I was sure it was working when I did it originally, so not a clue as to why or how it came to stop working, or with code that shouldn't have worked!