Forum: Ruby on Rails Plz provide code for (Drop down questions shouldn't have a N

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F82833108fae17f08bc78a1c4c9a5901?d=identicon&s=25 Prashanth Kumar (prashanth)
on 2009-06-05 09:50

Hi ,

Am very New to Rails..i Hav the following issue ..Plz tell way using
ruby on rail s code me to resolve the below .Plz Provide the code for
this issue.
issue:-

Drop down questions shouldn't have a None option- should say "Select
One".

Detailed Description for the issue:-

In the dropdown question it defaults to "none", that is confusing, can
you have it say, "Select One"
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-06-05 09:56
(Received via mailing list)
On Jun 5, 8:50 am, Prashanth Kumar <rails-mailing-l...@andreas-s.net>
wrote:
> Hi ,
>
> Am very New to Rails..i Hav the following issue ..Plz tell way using
> ruby on rail s code me to resolve the below .Plz Provide the code for
> this issue.
> issue:-
>
> Drop down questions shouldn't have a None option- should say "Select
> One".
>
depends on how you create that drop down box. Most of the rails
helpers have a :prompt option.

Fred
F82833108fae17f08bc78a1c4c9a5901?d=identicon&s=25 Prashanth Kumar (prashanth)
on 2009-06-05 10:06
Thanks Frederick.However for this i need to change the below mention
code you said  in rhtml file in my application View..


Frederick Cheung wrote:
> On Jun 5, 8:50�am, Prashanth Kumar <rails-mailing-l...@andreas-s.net>
> wrote:
>> Hi ,
>>
>> Am very New to Rails..i Hav the following issue ..Plz tell way using
>> ruby on rail s code me to resolve the below .Plz Provide the code for
>> this issue.
>> issue:-
>>
>> Drop down questions shouldn't have a None option- should say "Select
>> One".
>>
> depends on how you create that drop down box. Most of the rails
> helpers have a :prompt option.
>
> Fred
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-06-05 10:12
(Received via mailing list)
On Jun 5, 9:06 am, Prashanth Kumar <rails-mailing-l...@andreas-s.net>
wrote:
> Thanks Frederick.However for this i need to change the below mention
> code you said  in rhtml file in my application View..
>

You probably would, yes.

Fred
5f94b9b346c2aa648a80bc259978e5bc?d=identicon&s=25 Colin Law (Guest)
on 2009-06-05 22:41
(Received via mailing list)
2009/6/5 Prashanth Kumar <rails-mailing-list@andreas-s.net>:
> Drop down questions shouldn't have a None option- should say "Select
> One".
>
> Detailed Description for the issue:-
>
> In the dropdown question it defaults to "none", that is confusing, can
> you have it say, "Select One"
>

If you are still having difficulty, what code in your view file are
you using to show the select box?

Colin
F82833108fae17f08bc78a1c4c9a5901?d=identicon&s=25 Prashanth Kumar (prashanth)
on 2009-06-09 05:45
Thanks Colin,How ever am not able to find the exact location for this
code..
Can you plz guide me to find out the simplest way for this selection
code in my machine like any naming conventions follow for the view rhtml
file in my application.
And one more thing Actuvally my issue is to select one dropdown that
place previously it had None option now i should select the same with
the "Select one"

Plz tell wat are the exact file to change for this issue in my
application.

Thanks,
Prashanth

Colin Law wrote:
> 2009/6/5 Prashanth Kumar <rails-mailing-list@andreas-s.net>:
>> Drop down questions shouldn't have a None option- should say "Select
>> One".
>>
>> Detailed Description for the issue:-
>>
>> In the dropdown question it defaults to "none", that is confusing, can
>> you have it say, "Select One"
>>
>
> If you are still having difficulty, what code in your view file are
> you using to show the select box?
>
> Colin
5f94b9b346c2aa648a80bc259978e5bc?d=identicon&s=25 Colin Law (Guest)
on 2009-06-09 11:39
(Received via mailing list)
2009/6/9 Prashanth Kumar <rails-mailing-list@andreas-s.net>:
> Plz tell wat are the exact file to change for this issue in my
> application.

Are you saying that you do not know which file in your application is
showing the select box?  If you do not know then how am I to know?
It may be useful for you to go through some tutorials on how RoR
works.  The Rails guides are very good.
Colin
F82833108fae17f08bc78a1c4c9a5901?d=identicon&s=25 Prashanth Kumar (prashanth)
on 2009-06-18 16:16
Thank you Colin,
Please find the following issue and code  which i asked ..

issue:-

Drop down questions shouldn't have a None option- should say "Select
One".

Detailed Description for the issue:-

In the dropdown question it defaults to "none", that is confusing, can
you have it say, "Select One"


CODE:--

This is my file location in my local
machine:-C:\rails\sme_on_rails\app\views\presentation\content\question_widgets\_select.rhtml
_select.rhtml code:-

<% # $Id: _select.rhtml 5267 2009-04-02 22:05:54Z efinnera $
-%>

<% select_options = [] -%>
<%
@question.answers.find(:all, :order => "position ASC", :conditions =>
['parent_id IS NULL']).each{|answer|
  at = get_translation(answer, @translation.locale_id)
  select_options << [at.value, answer.id.to_s] if at
}
select_options = [[t('content_page.quiz_response.none', 'Select One'),
nil]].concat(select_options.compact)
-%>
<% onclick_script = '' %>
<% onclick_script +=
"toggleOtherTextBox('submitted_quiz_#{@question.id}_#{@other_answer_id}');"%>
<% onclick_script += "checkSkipping(#{@question.position - 1})"%>
<% previous_selection = params[:submitted_quiz]  ?
params[:submitted_quiz][@question.id.to_s] : nil %>
<div id='answers_<%= @question.id%>' class="quiz_answers">

<%=  select_tag("submitted_quiz[#{@question.id.to_s}]",
options_for_quiz_select(select_options, @question, previous_selection),
:disabled => (@ready_to_grade ? true : false), :onchange =>
onclick_script) %>
</div>

#### i changed the option instead of None..Select One...

How ever these updates are not reflecting my machine.. is any more
changes to do ...?

Thanks,
Prashanth ....




Prashanth Kumar wrote:
> Thanks Colin,How ever am not able to find the exact location for this
> code..
> Can you plz guide me to find out the simplest way for this selection
> code in my machine like any naming conventions follow for the view rhtml
> file in my application.
> And one more thing Actuvally my issue is to select one dropdown that
> place previously it had None option now i should select the same with
> the "Select one"
>
> Plz tell wat are the exact file to change for this issue in my
> application.
>
> Thanks,
> Prashanth
>
> Colin Law wrote:
>> 2009/6/5 Prashanth Kumar <rails-mailing-list@andreas-s.net>:
>>> Drop down questions shouldn't have a None option- should say "Select
>>> One".
>>>
>>> Detailed Description for the issue:-
>>>
>>> In the dropdown question it defaults to "none", that is confusing, can
>>> you have it say, "Select One"
>>>
>>
>> If you are still having difficulty, what code in your view file are
>> you using to show the select box?
>>
>> Colin
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-06-18 16:45
(Received via mailing list)
On 18 Jun 2009, at 15:16, Prashanth Kumar wrote:
>
> #### i changed the option instead of None..Select One...
>
> How ever these updates are not reflecting my machine.. is any more
> changes to do ...?
>

Your app is localized: you need to update the yml file with the
translations (for the key content_page.quiz_response.none )

Fred
F82833108fae17f08bc78a1c4c9a5901?d=identicon&s=25 Prashanth Kumar (prashanth)
on 2009-06-18 17:10
Thanks Fread,

After done my changes in the particular file..i hit a rake task for
label updation in my machine...

C:\rails\sme_on_rails>rake labels:scrape
(in C:/rails/sme_on_rails)
Scraping...

Then i check but not updated still in my screen its showing None
option...suppose to show Select one.


Regards,
Prashanth...

Frederick Cheung wrote:
> On 18 Jun 2009, at 15:16, Prashanth Kumar wrote:
>>
>> #### i changed the option instead of None..Select One...
>>
>> How ever these updates are not reflecting my machine.. is any more
>> changes to do ...?
>>
>
> Your app is localized: you need to update the yml file with the
> translations (for the key content_page.quiz_response.none )
>
> Fred
This topic is locked and can not be replied to.