close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Glitch with radio buttons on search

Thread began 11/18/2009 5:12 pm by iainmacdonald331081 | Last modified 11/20/2009 7:28 pm by Eric Mittman | 2040 views | 9 replies |

iainmacdonald331081

Glitch with radio buttons on search

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 :

www.mph.uk.com

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.

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 then the search wouldn't working - it only returned cars, but not vans.

If anyone could let me know how to fix this, that would be much appreciated.

Cheers.

Sign in to reply to this post

Dave BuchholzBeta Tester

Iain,

for radio buttons to work correctly they must be named the same so change your code to look like this:

<p>
<label><input type="radio" name="VehicleType" value="Car" id="VehicleType_0" class="tickbox"/> Cars</label>
<br />
<label><input type="radio" name="VehicleType" value="Van" id="VehicleType_1" class="tickbox"/> Vans</label>
<br />
</p>



and then change your code in the Data Assist Search from this:

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



to this:

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



I use radio button searches a lot in the admin panels that I build and this way of doing things has always worked for me so give it a go and see how you get on.

Sign in to reply to this post

iainmacdonald331081

Thanks Dave.

That was my first thought, that the radio buttons had to have the same name.

I've just tried your edits, and that resulted in the results displaying both cars and vans, no matter what was selected.

But strangely, I made copies of the relevant pages, and I was sure it worked with the new pages.

Then I resaved them back with the original file names, and they stopped working.

So at the moment, I have a new index page with your edits, showing it just selecting cars and vans :

indexnew.php

And its all very odd anyway as I'm sure it did work originally.

Sign in to reply to this post

Dave BuchholzBeta Tester

Iain,

Change the code in the Data Assist Search to this:

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



Note: I have changed the digit at the end to a zero which should give you a text match, a one as in the original code I gave you is a numeric match.

Sign in to reply to this post

iainmacdonald331081

Thanks Dave - that all seems OK now.

Although I am still confused because

a. I was sure it did work when I did it originally,

and

b. Presumably that was the code that WADA created.

In which case it would be interesting to see if anyone from WA can shed any light.

Sign in to reply to this post

Eric Mittman

Generally speaking the code itself will not change by storing on a new server or moving the pages in the site around, but sometimes the way servers are configured can make pages behave slightly differently. I'm not sure if that is the case for you.

To be able to get to the bottom of this we would need to be able to see and test the pages that are working on the previous server and compare them to the non working on the new server.

If you open the DataAssist Search server behavior you should be able to see the column type value here, if what you see here does not match what you have in the code please let us know so we can look into the issue further.

Sign in to reply to this post

iainmacdonald331081

Hi Eric -

The column type for each is T - text.

In the original, the radio button code was :

<label>
<input type="radio" name="VehicleType" value="Car" id="VehicleType_0" class="tickbox">
Cars</label>
<br >
<label>
<input type="radio" name="VehicleType2" value="Van" id="VehicleType_1" class="tickbox">
Vans</label>



Is that correct? ie with them having different names?

And in the results page, the code was :

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



Does that look about right? I thought it was working, but it may be that there was a glitch all along...

So now it is working again with Dave's edits above, ie giving the radio buttons the same name :

<label>
<input type="radio" name="VehicleType" value="Car" id="VehicleType_0" class="tickbox">
Cars</label>
<br >
<label>
<input type="radio" name="VehicleType" value="Van" id="VehicleType_1" class="tickbox">
Vans</label>



And changing the two lines above in the results page to the single line :

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



Make any sense?

Sign in to reply to this post

Eric Mittman

Do you have access to the server with the older versions of the pages working correctly? From what you have posted and the edits that Dave helped with I'm not so sure that it would work correctly with the older code.

The edits that were made to get it working are exactly rite, thanks for you help and insight on this one Dave.

Sign in to reply to this post

iainmacdonald331081

I don't I'm afraid, as the site owner changed hosting company.

If the new code above is the sort of thing that WADA would create, I'm not sure why I would have changed it. And at the same time its odd to think that I would have done it, tested it, and thought it was all working.

Might just have to put it down to one of those odd things.

:)

Sign in to reply to this post

Eric Mittman

While it remains a mystery as to why this may have been working I'm ok with just moving on if you are. Please let us know if anything like this happens again for you or if you encounter any other issues.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...