Getting specific form data loaded into a function

Discussion in 'Javascript' started by Sam Wuebben, Jan 27, 2004.

  1. Sam Wuebben

    Sam Wuebben Guest

    I've been trying to get the values of hidden fields from one of many
    forms on a page to load into a function.

    The test page is at: http;//www.mvldesign.com/test/item_pop.html

    The 'Add to Cart" image needs to send that forms data to the function
    seen in the head.

    Firebird's javascript Console states that "form has no properties"

    What am I doing wrong?

    I've looked thru all the typical resources and haven't found the
    answer. Any specifics or general suggestions would be helpful.

    More info than you need.........

    I decided to use a form to hold the product data because the site
    owner wants to be able to change each products status nightly and he
    uses DW3. I made the product status be a DW Library item so he only
    needs to select the library item and replace it with the new status.
    Product data is not affected or changed. Less chance that he could
    break something.

    He has over 1000 products and he wants to manage them all by hand. So
    I need the form code to be as generic as possible and, hopefully, not
    depend on targeting a specific form name. He could add products
    himself using an HTML code snip that would be a generic properly
    classed table cell with an image place holder, the form, hidden
    fields and submit image. Then he only needs to change the image and
    the hidden fields values to have a new product.

    eventually, all he needs is to have the form data filled in on a form
    on the page at his secure server. Nothing real fancy since he wants to
    limit each online purchase to no more than three items. If some one
    cares to suggest another non-database driven way of doing all this I'd
    be open.

    Thanks for looking

    Sam Wuebben
     
    Sam Wuebben, Jan 27, 2004
    #1
    1. Advertising

  2. "Sam Wuebben" <> wrote in message
    news:...
    >I've been trying to get the values of hidden fields from one
    >of many forms on a page to load into a function.
    >
    >The test page is at: http;//www.mvldesign.com/test/item_pop.html

    ^
    : ?

    >The 'Add to Cart" image needs to send that forms data to
    >the function seen in the head.
    >
    >Firebird's javascript Console states that "form has no
    >properties"
    >
    > What am I doing wrong?

    <snip>

    |<a href="javascript:;" onClick="writeIt(this.form)"><img src=" ...

    The problem that is causing the error is attempting to pass a reference
    to the form as an argument in the function call using - this.form -. As
    the internally generated onclick handler becomes a method of the A
    element the - this - keyword become a reference to that element and A
    elements do not have - form - properties. So the argument passed is
    undefined and undefined has no properties.

    The next problems are the combination of failing to cancel the
    navigation using the onclick handler and the internally-suppressed-error
    producing formulation of the javascript pseudo protocol in the HREF.

    But really that is just the tip of the iceberg. The whole client-side
    shopping cart/cookies/widow opening scheme is at best unreliable. Not
    appropriate for e-commerce.

    Richard.
     
    Richard Cornford, Jan 27, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marcelo Birnbach [MS]
    Replies:
    0
    Views:
    3,330
    Marcelo Birnbach [MS]
    Jun 28, 2003
  2. Udo Corban
    Replies:
    0
    Views:
    3,854
    Udo Corban
    Jan 23, 2004
  3. Micha³ Januszczyk

    Getting values entered into (dynamicly loaded control)

    Micha³ Januszczyk, Mar 9, 2005, in forum: ASP .Net Building Controls
    Replies:
    4
    Views:
    125
    Mantas Miliukas
    Mar 10, 2005
  4. Monty
    Replies:
    1
    Views:
    172
    Monty
    Jul 21, 2005
  5. Micha³ Januszczyk

    Getting values entered into (dynamicly loaded control)

    Micha³ Januszczyk, Mar 9, 2005, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    117
Loading...

Share This Page