close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Changing Foreign Key from numeric to text. Now search does not work

Thread began 3/09/2012 11:13 am by John Langer | Last modified 3/09/2012 1:54 pm by Jason Byrnes | 619 views | 5 replies |

John LangerBeta Tester

Changing Foreign Key from numeric to text. Now search does not work

Hi,

I created an admin section some time ago using the data assist wizard and it works very well. Now my client requires (for reasons involving a third party) that a foreign key used, is changed from a numeric ID (INT), to a text field (VarChar). I've done this and the basic insert, update and display works fine but the search does not. I have the search form on the results page as well as the normal separate file (I've attached them both). This particular search field (Region) is using a dynamic drop down menu.

The field involved is FKeventsRegionID. It used to be 1, 2, 3 etc but is now "England: South East", "England: East" etc

There is obviously something I've missed here but for the life of me it escapes me. Can you help please?

If you go here you will see a search on the right using a drop down. This works fine. This site is still using the old code but on my testing server it works fine.

Any help appreciated.

Attached Files
Search.zip
Sign in to reply to this post

Jason ByrnesWebAssist

if you view source of the search form, the value of the region seelct list is stil using the numeric values, not the strings:

<select name="region" class="dropBox">
<option value="">All</option>
<option value="1">England: East</option>

<option value="2">England: East Midlands</option>

<option value="3">England: London</option>

<option value="4">England: North East</option>

<option value="5">England: North West</option>

<option value="6">England: South East</option>

<option value="7">England: South West</option>

<option value="8">England: West Midlands</option>

<option value="9">England: Yorkshire and the Humber</option>

<option value="21">National</option>

<option value="10">Northern Ireland</option>

<option value="11">Scotland: Central</option>

<option value="12">Scotland: Highlands and Islands</option>

<option value="13">Scotland: North East</option>

<option value="14">Scotland: South East</option>

<option value="15">Scotland: South West</option>

<option value="16">Scotland: West</option>

<option value="17">Wales: Mid</option>

<option value="18">Wales: North</option>

<option value="19">Wales: South East</option>

<option value="20">Wales: South West</option>

</select>




you will need to edit the select list so that the value uses the same column as the label.

Sign in to reply to this post

John LangerBeta Tester

Hi Jason,

Thanks for the reply. The view source isn't really a true reflection. I haven't changed anything on the live site so it would show numeric options. On my testing server it shows the following

html:
<td>
<select name="region" class="dropBox">
<option value="">All</option>
<option value="England: East">England: East</option>

<option value="England: East Midlands">England: East Midlands</option>

<option value="England: London">England: London</option>

<option value="England: North East">England: North East</option>

<option value="England: North West">England: North West</option>

<option value="England: South East">England: South East</option>

<option value="England: South West">England: South West</option>

<option value="England: West Midlands">England: West Midlands</option>

<option value="England: Yorkshire and the Humber">England: Yorkshire and the Humber</option>

<option value="National">National</option>

<option value="Northern Ireland">Northern Ireland</option>

<option value="Scotland: Central">Scotland: Central</option>

<option value="Scotland: Highlands and I">Scotland: Highlands and Islands</option>

<option value="Scotland: North East">Scotland: North East</option>

<option value="Scotland: South East">Scotland: South East</option>

<option value="Scotland: South West">Scotland: South West</option>

<option value="Scotland: West">Scotland: West</option>

<option value="Wales: Mid">Wales: Mid</option>

<option value="Wales: North">Wales: North</option>

<option value="Wales: South East">Wales: South East</option>

<option value="Wales: South West">Wales: South West</option>

</select>
</td>

I was merely trying to point out that a "similar" search worked on my testing server with the new text "options" or text ID's in the database.

I've just tried the same exercise on the search page of my admin section (on my testing server) and this is showing the correct options

html:
<th class="WADADataTableHeader">Region:</th>
<td class="WADADataTableCell">
<select name="S_FKeventsRegionID" id="S_FKeventsRegionID">
<option value="">All</option>
<option value="England: East">England: East</option>
<option value="England: East Midlands">England: East Midlands</option>
<option value="England: London">England: London</option>
<option value="England: North East">England: North East</option>
<option value="England: North West">England: North West</option>
<option value="England: South East">England: South East</option>
<option value="England: South West">England: South West</option>
<option value="England: West Midlands">England: West Midlands</option>
<option value="England: Yorkshire and the Humber">England: Yorkshire and the Humber</option>
<option value="National">National</option>
<option value="Northern Ireland">Northern Ireland</option>
<option value="Scotland: Central">Scotland: Central</option>
<option value="Scotland: Highlands and I">Scotland: Highlands and Islands</option>
<option value="Scotland: North East">Scotland: North East</option>
<option value="Scotland: South East">Scotland: South East</option>
<option value="Scotland: South West">Scotland: South West</option>
<option value="Scotland: West">Scotland: West</option>
<option value="Wales: Mid">Wales: Mid</option>
<option value="Wales: North">Wales: North</option>
<option value="Wales: South East">Wales: South East</option>
<option value="Wales: South West">Wales: South West</option>
</select>
</td>

I hope that clarifies things a bit better. Sorry if I mislead you before.

Sign in to reply to this post

Jason ByrnesWebAssist

in the data assist search behavior the column type for the FKeventsRegionID column is set to Numeric, you will need to change that to set the column type to text.

Sign in to reply to this post

John LangerBeta Tester

Thanks jason, that did it.

Obvious really. Doh! :)

Sign in to reply to this post

Jason ByrnesWebAssist

glad to hear it is working.

Sign in to reply to this post

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