alcina
September 5, 2013, 3:33pm
1
Hi,
I need to “popup” a message to the user in order he can choose an
option. It is not a YES-NO option but almost the same (has has to choose
among two options). It has to be a message with a question and two
buttons.
Is that possible on Rails?
Thanks!
Jorge
satoshi
September 5, 2013, 3:34pm
2
I believe the standard way to do this would be to show a previously
hidden div containing a form.
satoshi
September 5, 2013, 3:35pm
3
Joel P. wrote in post #1120757:
I believe the standard way to do this would be to show a previously
hidden div containing a form.
And that is possible using Rails or is it Javascript?
satoshi
September 5, 2013, 3:52pm
4
You would show and hide the element with JavaScript, but create it in
Rails. Simple example:
<%= form_for @knight do |f| %>
<%= f.label :favorite_color, 'What\'s your favorite color?' %>
<%= f.collection_select :favorite_color, %w(red green blue aaaaah),
:to_s, :titleize, :prompt => true %>
<%= f.submit %>
Take the challenge!
//script
$(‘color-button’).observe(‘click’, function(){
$(‘favorite-color’).show();
});
Walter