The $F(id) function returns the value of the form field where the id
is the id of the form field.

example
mark up
<input type="text" name="foo" id="foo_id" value="123" />

javascript
var fooValue = $F('foo_id');

Now fooValue == "123" should return true.

It does different things depending on what type of form field you are
asking for the value of (i.e. select, checkbox, radio, textare).  But
it is always a read only string from my understanding.

I think $F just masks to Form.Element.getValue so you can look at that
function in protoype if you want for more details.

Nicholas

On 3/2/06, Robin Haswell <[EMAIL PROTECTED]> wrote:
> Tried $F('name').value = "foo"; ?
>
> I'd assume $F returns the first form element it finds.
>
> -Rob
>
> Alex Duffield wrote:
> > I also have a question about $F()  while we are on the topic..
> >
> > am I correct in assuming that $F()  is read only?
> >
> > I have never been able to set a forms elements value using
> >
> > $F('name')="Alex"
> >
> > I have always had to use
> >
> > $('name').value = "Alex"
> >
> >
> > ______________________________________________________________________
> >
> > *Alex Duffield* *.* *Principal* *.* *InControl Solutions* *.*
> > *http://www.incontrolsolutions.com* <http://www.incontrolsolutions.com/>
> >
> >
> >
> >
> > On 2-Mar-06, at 8:22 AM, Maninder, Singh wrote:
> >
> >> Hi Guys,
> >>
> >> Maybe this is a stupid question, but I am confused at the moment.
> >>
> >> The $F() function is a handy shortcut to get the value of the an input
> >> field.
> >>
> >> So, doing something like $F('name') is equivalent to
> >> document.formname.name.value which is pretty cool.
> >>
> >> Now, what if I have 2 forms on the page, that same field name "name"?
> >> What would $F return? It does not take the form name - right?
> >>
> >> Thanks,
> >> Mandy.
> >> _______________________________________________
> >> Rails-spinoffs mailing list
> >> Rails-spinoffs@lists.rubyonrails.org
> >> <mailto:Rails-spinoffs@lists.rubyonrails.org>
> >> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Rails-spinoffs mailing list
> > Rails-spinoffs@lists.rubyonrails.org
> > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>


--
DCRails.com || Making the Metrorail fun!
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to