Displaying 20 results from an estimated 5000 matches similar to: "Fwd: autocomplete and one to many relationships"
2006 Aug 03
0
autocomplete and one to many relationships
Hello,
I am trying to get autocomplete to save record ID.
I have to tables:
Students and Departments.
Students table has department_id field.
Department table has 2 fields: id and name
I set up belongs_to: and
has_many: entries in the models of each.
In my _form.rhtml I have the autocomplete line that is working:
<%= text_field_with_auto_complete :department, :name %>
ie.
2006 May 22
0
(nebie) Autocomplete and many to one relationship?
All,
I''m trying to get autocomplete to work for the first time.
I''m not sure if I''m doing this right or not.
I have a table where one of the fields is a employees name. I expect a
relatively small collection of person''s names will be used.
I created a simple employees table with just 2 fields: id, and name.
Then in my main table I added a employee_id field
2005 Sep 26
1
[Fwd: [Rails] Re: Autocomplete - setting a second value?]
Yeah, right... I posted this to the Rails mailing list.
Sorry for people who see duplicate posts.
-------- Original Message --------
Subject: [Rails] Re: [Rails-spinoffs] Autocomplete - setting a second value?
Date: Mon, 26 Sep 2005 10:05:24 -0400
From: Fran?ois Beausoleil <fbeausoleil@ftml.net>
Reply-To: rails@lists.rubyonrails.org
To: rails@lists.rubyonrails.org
References:
2006 Mar 01
2
Validating that a foreign key is present and ok
How do I validate that a model object''s attribute is a valid foreign
key? The problem is, I can''t check if the attribute is a valid foreign
key if the attribute doesn''t even exist.
For example, every employee must be in a department. In the following
code, if an employee''s department_id is not present then
Department.find_by_id(department_id) might cause
2006 Mar 22
0
Another Problem with params
I am trying to do a similar thing for some spares that I am trying to manage...
My spare.rb file is as under
class Spare < ActiveRecord::Base
belongs_to :department, :class_name => ''department'', :foreign_key
=> ''department_id''
belongs_to :subequipment, class_name => ''subequipment'',
:foreign_key =>
2006 Mar 13
2
Autocomplete broken after update to Rails 1.0
When I upgraded to 1.0, I broke autocomplete on a field. I''ve done
everything that I can think of to fix the problem, but nothing has
worked. I''m able to recreate a simple autocomplete from examples on the
various tutorials, but my original code just will not work.
<input id="incident_first_party_name" name="incident[first_party_name]"
2005 Aug 24
1
Re: triggering autocomplete with a button press
I''ve got a search field on my site that uses an autocomplete to match
against search terms already input by the same user. That''s working
perfectly. However, I''d like to provide a little button next to the
search field that triggers the autocomplete, so that the users can
"browse" the list of past search terms. This behavior would be in
addition to the
2006 Mar 12
3
Newbie: using find like a sql join query
I have a working Rails app with several related tables, but can''t find
an answer to this question in the Dave Thomas Rails book. Imagine for
example:
table departments with columns: id, department_name
table employees with columns: id, department_id, employee_name
and of course the employees table has a constraint foreign key
(department_id) references departments(id)
So this is
2005 Aug 01
2
disable ''tab'' key wish for incremental autocomplete of textareas
I''m absolutely in love with the incremental
autocomplete feature in the new scriptaculous.
My one wish would be for some way of disabling the TAB
key to prevent users from being able to tab out of an
autocompleting textarea. (If they''re using TAB to
select the autocomplete choice they end up tabbing
straight out of the input field if autocomplete
doesn''t find any
2005 Oct 20
1
Autocomplete - Destroying the object
Hi,
I''m new to all this so if this is a daft question sorry.
I''m using Ajax Autocomplete to populate a search box with likely matches.
These results need to be filtered by an option from a select box that
is alongside the search box.
As the current Autocomplete function only takes in one id to post to
the search file, i figured i could post more stuff to the
Ajax.Autocompleter
2006 Jan 23
1
autocomplete=off not working on Firefox
I noticed that the latest control.js disables auto complete:
this.element.setAttribute(''autocomplete'',''off'');
So I removed my inline "autocomplete=''off''" from my input fields.
But Firefox still auto completes.
Using the Firefox DOM Inspector I do see that it''s applied
by Ajax.Autocompleter as expected. The Inspector
2005 Dec 21
3
How to make a drop-down automatically submit an AJAX form
Hi,
I know that to make a dropdown box automatically submit when you change
the value, you do this:
<select ..... onchange="this.form.submit();">
BUT i''ve got an ajax form, and if i do the above trick, it simply
reloads the ajax partial into the whole screen, rather than into the div
where it is meant to go.
I''ve already got it all working so that if you click
2006 Apr 26
2
two layers of has_many
Hi,
There are many companies. Each company has many departments. Each
department has many employees. The following find_by_sql method seems
awful. What is the best way to get all the employees of a company?
class Company < ActiveRecord::Base
has_many :departments
def employees
Employee.find_by_sql("SELECT employees.*
FROM companies, departments, employees
2011 Oct 24
1
JQuery autocomplete example
I was trying to follow along on the github example
(https://github.com/crowdint/rails3-jquery-autocomplete) for building
an autocomplete and ran into a small set of problems. I''m not using
the exact names of models, but I suppose I could. It''s just a dummy
set. For me: Model is Package and attribute is Brand.
I don''t understand what the reference to class
2012 Apr 09
0
Autocomplete text-field version of dynamic select menu?
I have a form for submission of brand, model, and style. Style
belongs_to model, and model belongs_to brand. The form is actually a
style submission form, but allows users to create new brands or models
as well, should they not exist.
What I want is for the autocomplete for ''model'' to populate when an
object for ''brand'' is selected in the first text field..
2006 Feb 11
1
autocomplete inside a table?
Has anyone tried putting an autocomplete field inside a table?
I can do this successfully within FireFox, but in IE, it just doesn''t
render the "drop-down" autocomplete div. Unfortunately, I don''t
understand enough about why IE doesn''t work to know how to fix it.
My autocomplete div CSS is:
div.auto_complete {
position: fixed;
border: 1px solid #eee;
2006 Jan 21
0
Display options from HABTM
I have a large certifications table that I would like to have a little
more controll over, it is part of a HABTM relationship.
-----------------------------------
db''s (simplified)
>certifications
id
course
>employees
id
department_id
type_id
name
>departments
id
name
>types
id
kind
>certifications_employees
certification_id
employee_id
2007 Aug 08
1
autocomplete field in ajax response html - css does not get applied.
Hi all,
I have a page in which a div is updated with some html via Ajax. The
returned html contains an autocomplete field. The autocomplete field
works but the drop down results div does not get css applied to it so the
selections don''t get highlighted when I use the up/down arrows and so
I am unable to select from the drop down except for the first item. I
have been looking at this in
2006 May 16
0
in_place_editor with local autocomplete
Hi Rails gals n guys
I am trying to enhance the "Lightning-Fast JavaScript Autocompletion"
rails recipe. For those that do not have the pdf-book the recipe
explains how to use a javascript array for an auto-complete text field.
I want to combine this with the in_place_editor call. My current
(unworking) code:
<!-- Load the array for autocomplete -->
<script
2009 Oct 29
0
Javascript in text field with autocomplete
If I am using the autocomplete plugin, and I have a text field
specified in a form that incorporates autocomplete, such as:
<%=
text_field_with_auto_complete :doctor, :organization, :autocomplete =>
"off" %>
how can I put javascript event handlers to if (e.g. keypress,
onchange, etc.) ? WHat I really want to do is call a method in my
controller if either:
1. The text field is