Current location: Hot Scripts Forums » General Web Coding » JavaScript » help needed for DB search form


help needed for DB search form

Reply
  #1 (permalink)  
Old 03-18-09, 05:35 AM
tigergrai tigergrai is offline
New Member
 
Join Date: Mar 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
help needed for DB search form

Hi all :-) I am a complete novice at all of this so please be patient with me! :-)

I've recently built a website that has an online DB of horse pedigrees. I am using a pedigree script based on perl.

The front end search page is comprised of javascript and a form which - when submitted generates the pedigrees. The form has various criteria which the user completes such as number of generations to display, the name being searched for, the database and the type of search (quick or slow). The form appears to be tied in to the javascript for each 'criteria'.

On the site I ahve a smaller search form comprising just a text entry box and a search button. I'd like to use this in place of the longer form above. So, I am guessing that there is someway that I can make the script automatically select a predetermined number of generations, the DB it is searching, the type of search - and have all this info hidden from the user, ie just running in the background - and then all the user does is enter a name to search for in the one field.

Am I right in thinking this can be done?

And can someone help me set it up properly? :-)

many thanks!

geraldine
Reply With Quote
  #2 (permalink)  
Old 03-19-09, 01:32 AM
dgreenhouse's Avatar
dgreenhouse dgreenhouse is offline
Aspiring Coder
 
Join Date: Mar 2009
Location: San Francisco
Posts: 457
Thanks: 0
Thanked 3 Times in 3 Posts
You're thinking appears valid, but it's impossible to help without seeing the code.

If you elect to post some code, please read up on the forum about formatting and embedding the code using the vB Code tags (see: lower left of all forum pages).

Also, PLEASE indent your code with spaces - Not TABS!

It's very frustrating trying to read unformatted programs.

I ( for one) just ignore the code until the poster makes it easy to read.
Reply With Quote
  #3 (permalink)  
Old 03-19-09, 04:54 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
Each form element like the input element and select element have values.

The input element has properties like type and value.
The select element has property value.

Sense the Javascript deals with the value property and the user enters or selects a value,
then all you need to do is assign a value to the elements that you want to have a predefined value.
Javascript will also use the id and/or the name property of the element.
And PHP will use the name property to process the values of the elements.

So, if you assign a predefined value to the input elements and set their type value to hidden then Javascript will use the values assigned to those elements and the user will not see them.

Then you convert any select elements you want hidden, to input elements using the same id and name.
And set the type property to hidden.

Do you understand?
__________________
Jerry Broughton
Reply With Quote
  #4 (permalink)  
Old 03-19-09, 10:32 PM
tigergrai tigergrai is offline
New Member
 
Join Date: Mar 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
hi guys, thank you both very much for your great replies.

dgreenhouse - many thanks for being willing to look at the code, I really appreciate you taking the time to consider this. :-)

Jerry - I had to read and reread your reply a few times - I am completely new to this. However, I gave it a go and it worked! :-) Many thanks!

To both of you, many thanks and I wish you both a great weekend!

Geraldine
Reply With Quote
  #5 (permalink)  
Old 03-19-09, 11:25 PM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
Your welcome.
__________________
Jerry Broughton
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ajax checking and onsubmit issue follower JavaScript 4 10-12-08 03:45 PM
Search form causing errors? jwh JavaScript 3 02-09-06 09:41 AM
search form with date search newbieasp24 ASP 1 10-17-04 02:52 PM
Declared Functions skipper23 PHP 4 12-17-03 10:06 AM
index page not showing up skipper23 PHP 3 12-15-03 01:10 PM


All times are GMT -5. The time now is 11:46 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.