Javascript

Hi

I have a form

<%= form_remote_tag :url => { :action => ‘sd_resolution_save’,
:id => @sd_ticket.id, },%>

<td><table><tr>

<th width=""><label for="" >Hr: </label></th>
<td><%= text_field :sd_resol, "hours", "size" => 2 %></td>
<th width=""><label for="" >Min: </label></th>
<td><%= text_field :sd_resol, "minutes", "size" => 2 %></td>

</tr></table></td>
Resolution Code <%= select( "sd_resolution", "service_desk_resolution_code_id", ServiceDeskResolutionCode.find(:all).collect {|p| [ p.name, p.id ] }) %>
Effort

Save

<%= end_form_tag %>

And javascript is

script type=“text/javascript”>

function checkResolution(elem,days,hours,minutes, helperMsg)
{

  for (i=0;i<elem.length;i++)
{
if (elem.options[i].selected){
  if( elem.options[i].text.toLowerCase()== "<< select any >>"){
    alert(helperMsg);
  elem.focus();
    return false;
  }
 }
}
//alert(days.value);

}

HERE THE CHECKING HAPPENS BUT THE ALERT MESSAGE IS NOT PRINTED (For
example if i select nothing in the select box and click ok button
nothing happens).WHY?

Sijo

Nothing happens because nothing is selected and your snippet returns
void which == false

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs