GithubHelp home page GithubHelp logo

Comments (7)

ckirkendall avatar ckirkendall commented on July 28, 2024

@terjesb I have a feeling this is due to the call to (.-elements node) in the code. My guess is IE8 returns some native object that doesn't extend the right protocols. I don't have IE 8 to test this so if I come up with a solution can you test it.

(defn read-form
  "returns a map of the form values tied to name of input fields.
   {:name1 'value1' name2 #{'select1' 'select2'}}"
  []
  (extr-multi-node
   (fn [node]
     (let [inputs (.-elements node)]
       (reduce
        #(if-not (empty? (.-name %2))
           (merge-form-val %1
                           (keyword (.-name %2))
                           ((read-form-input) %2))
           %1)
        {} inputs)))))

from enfocus.

ckirkendall avatar ckirkendall commented on July 28, 2024

oops hit the wrong button and closed this.

from enfocus.

terjesb avatar terjesb commented on July 28, 2024

Thanks! It almost looks as if IE8 doesn't have an 'elements'. When I check the debugger, it says that elements is also a DispHTMLFormElement, the same as the form itself. When I do an alert(document.getElementById("myform").elements), it prints [object HTMLFormElement].

skjermbilde 2014-04-29 kl 19 25 56

from enfocus.

terjesb avatar terjesb commented on July 28, 2024

Perhaps a solution could be to use goog.dom.forms.getFormDataAsMap and then transform that to a regular (read-form)-compatible map.

from enfocus.

ckirkendall avatar ckirkendall commented on July 28, 2024

It because the form itself in IE8 operates as the array. I think it would be best to just use (range (.-length inputs)) and (.item inputs %2) where %2 is.

(defn read-form
  "returns a map of the form values tied to name of input fields.
   {:name1 'value1' name2 #{'select1' 'select2'}}"
  []
  (extr-multi-node
   (fn [node]
     (let [inputs (.-elements node)]
       (reduce
        #(if-not (empty? (.-name (.item inputs %2)))
           (merge-form-val %1
                           (keyword (.-name (.item inputs %2)))
                           ((read-form-input) (item inputs %2 ))
           %1)
        {} (range (.-length inputs))))))

I don't have IE8 so I will try to patch it tonight and maybe you can test in the morning.

from enfocus.

ckirkendall avatar ckirkendall commented on July 28, 2024

@terjesb I pushed a new snapshot version with the fix. Can you test it out.

from enfocus.

terjesb avatar terjesb commented on July 28, 2024

Great, now it works in IE8. Thank you very much.

from enfocus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.