ropensci-archive / usgs_app

:no_entry: ARCHIVED :no_entry:
4 stars 4 forks source link

Don't allow Enter to start new line in textarea input box #15

Closed sckott closed 8 years ago

sckott commented 11 years ago

This is with respect only to having a submit button in the app, which I will likely add. Would be nice if hitting enter in the input box activated the submit button instead of starting a new line. Thoughts anyone? @ropensci/owners

karthik commented 11 years ago

By input box do you mean the text area where people enter species?

Unfortunately you can't trigger with enter because textarea is multi-line. If it was an input text then enter would work. So we do need a button here.

On Saturday, June 8, 2013 at 11:52 AM, Scott Chamberlain wrote:

This is with respect only to having a submit button in the app, which I will likely add. Would be nice if hitting enter in the input box activated the submit button instead of starting a new line. Thoughts anyone? @ropensci/owners

— Reply to this email directly or view it on GitHub (https://github.com/ropensci/usgs_app/issues/15).

sckott commented 11 years ago

Yes, that's the one. Yeah, I think we have to have the submit button because, for example, the interactive map will update on every key stroke in the text area for entering species, instead when you are done typing...

ramnathv commented 11 years ago

The select2.js solution would avoid the need for a submit button. But it would suffer from the issue of the change not being communicated back to R. Maybe it is possible to silently trigger a click in the background as users add more species to the list, so that the map updates.

sckott commented 11 years ago

Ramnath, Yes, looking forward to select.js being able to send changes to R.

There are some new features with Shiny v0.6.0 - perhaps there is something in there to help us

sckott commented 11 years ago

Just going with submit button for now

ramnathv commented 11 years ago

The current implementation requires the submit button to be pressed even when just updating the color or map provider. Can you isolate the effect of the submit button so that it is required only to retrieve data from the API. I haven't seen your implementation, but I believe that isolating the submit button's effect to the data function would do the trick.

sckott commented 11 years ago

Good point. Yes, I will try to isolate the Submit button's action.

sckott commented 11 years ago

Hmmm, does isolate() work with only the actionButton? Or with Submit Button as well?

ramnathv commented 11 years ago

I think I see the issue now. The submit button in that tab prevents any actions from occurring till it is hit. I am trying to figure out how we can modify the code so that when the submit button is pressed after a user chooses a different map provider, the app doesnt connect to the API to fetch the data all over again.

sckott commented 11 years ago

Perhaps we can isolate the changes to the map styling only (color palette, map layer) so that those don't trigger API calls - all other changes in the sidebar need to call APIs again (taxon names, number of occurrences, number of papers).

ramnathv commented 11 years ago

Good point.

sckott commented 11 years ago

I will try isolating the map styling then to not trigger API calls. I am also adding download buttons on each tab...

ramnathv commented 11 years ago

You might want to see if actionButton works better, since you can control things better. An ugly hack would work as follows.

  1. Add an <input id = 'actionbtnstate' type='text' style='display:none;'> to your UI, and initialize to 0
  2. Add an actionButton to your UI.
  3. When actionbutton is hit, its value gets incremented by 1. In the part where you get your data, you can add a check that compares the actionbutton value with the actionbtnstate and if they differ trigger data retrieval and then use updateTextInput to update the value of actionbtnstate. This will ensure that every time the action button is clicked, the data retreival process is triggered.