I have a helper method that takes the known input field, does a lookup
to a third-party web API and returns a hash of all the fields required
for the item record. I don't mind waiting for the lookup to take
place.
Once the record has been created, the edit function will not present
the lookup button.
Thanks!
def new
hobo_new Foo.new(get_foo_attributes)
end
I have a Book Model with fields like so:
fields do
isbn :string
loc :string
title :string, :required
author :string, :required
edition :string
#condition :string
condition enum_string(:Very_Good, :Fair, :Good, :Fine, :Mint)
bookformat :string
askingprice :string
comments :text
timestamps
end
I want to allow the user to click on the "New Book" link in the Books
index page, enter the isbn, then press a button or click a link to do
a lookup to a restful API service like isbndb.com to get the rest of
the data about the book like author, publisher, pricing info, and
populate those fields on the New Book page, and allow the user to
review the data before clicking the Save Book or Cancel button.
I want to make this a separate action tied to a button or link as
opposed to an ajax action triggered by tabbing out of the isbn field,
because I do not want this to be done automatically when editing an
existing book.
I am assuming I will have a book_helper method called get_isbn_info
(isbn) which returns a hash of fields in my book instance, populated
or not depending on whether I got a hit, service timed out, etc..
Hope this makes things clearer. It's more the dryml and controller
setup I'm puzzled about. (That is to say more puzzled than my normal
'lets start by jumping in at the deep end' state of befuddlement)
Tom P.
I think that's fairly close to what you're looking for. \
Bryan
--Matt Jones
> --
> You received this message because you are subscribed to the Google
> Groups "Hobo Users" group.
> To post to this group, send email to hobo...@googlegroups.com.
> To unsubscribe from this group, send email to hobousers+...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/hobousers?hl=en
> .
>
On Feb 2, 2:59 pm, Matt Jones <al2o...@gmail.com> wrote:
> I'll second that recommendation - it should be (relatively)
> straightforward to have a button that fires the Hobo.ajaxRequest
> stuff. The only gotcha I could see is the "parts don't work unless
> there's code inside" - do <input> tags count, Bryan?
>
> --Matt Jones
>
> On Feb 2, 2010, at 4:55 PM, Bryan Larsen wrote:
>
> > Have you seen this recipe?http://cookbook.hobocentral.net/recipes/33-ajax-filtering-on-a-partia...