infinitered / ProMotion-form

Deprecated -- use ProMotion-XLForm
19 stars 11 forks source link

Text fields sometimes convert content to a number #49

Closed Siggs2000 closed 9 years ago

Siggs2000 commented 9 years ago

Occasionally when I render the data from a form the text value entered is somehow changed to a huge negative number like: -1441151880758529039

It seems to happen most when the text value is very short. It also happens on password type forms.

I'm using gem version 0.3.1 and PM version 2.4.2 in redpotion 1.4.0

kevinvangelder commented 9 years ago

@Siggs2000 Can you show the code you are using to create the field and retrieve the value?

carlinisaacson commented 9 years ago

@Siggs2000 We ran into this issue on the app we are working on as well. Related issue #47 for reference.

In redpotion you can find the form field and grab the text from it, but with more than a few form fields that can get messy.

The best solution we found was switching to PM-XLForm.

Siggs2000 commented 9 years ago

I think I'm going to make that switch but ran into a little issue there that I just worked out this morning. Thanks.

andersennl commented 9 years ago

Same problem here, drives me crazy... Here is the code:

class NewEntryTableScreen < PM::FormScreen
  title "Title"
  # stylesheet NewEntryTableScreenStylesheet

  def on_load
    set_nav_bar_button :right, title: "Save", action: :nav_right_button
  end

  def form_data
    [{
      title: "Date and time",
      cells: [{
        name: "time",
        title: "When?",
        type: :datetime,
      }, {
        name: "duration",
        title: "How long?",
        type: :text,
        placeholder: "Time in minutes"
      }, {
        name: "rating",
        title: "Rating?",
        type: :text,
        options: ["1", "2", "3", "4", "5"]
      }, {
        name: "description",
        title: "Description",
        type: :longtext
      }]
    }]
  end

  def nav_right_button
    mp render_form
  end
end

This is what gets rendered and I entered:

bildschirmfoto 2015-11-14 um 20 03 45

Terminal output:

(main)> {
  :time          => 2015-11-14 20:03:24 +0100,
  :duration      => -1441151880758558631,
  :rating        => "5",
  :description   => "my description"
}

mp data[:duration].class => Fixnum

Ligator commented 9 years ago

+1

jamonholmgren commented 9 years ago

Hey guys,

I'm not going to be supporting ProMotion-form any longer. We now use ProMotion-XLForm instead. If you want to submit a patch for this, I'd be happy to merge it and release a new version, but won't have time to debug it myself.

Thanks!

Siggs2000 commented 9 years ago

I switched to ProMotion-XLForm too and it was a really easy transition and it works great

andersennl commented 9 years ago

Yeah I'll switch as well then, I just wasn't sure which gem to go with.

jamonholmgren commented 9 years ago

ProMotion-form has been officially deprecated. Thanks everyone!

http://jamonholmgren.com/deprecating-promotion-form/