Click here to Skip to main content
15,892,537 members
Home / Discussions / JavaScript
   

JavaScript

 
Questiondropdown check for same values Pin
01karan6-Oct-13 22:05
01karan6-Oct-13 22:05 
AnswerRe: dropdown check for same values Pin
DaveAuld13-Oct-13 21:46
professionalDaveAuld13-Oct-13 21:46 
AnswerRe: dropdown check for same values Pin
Abhinav S13-Oct-13 23:50
Abhinav S13-Oct-13 23:50 
GeneralRe: dropdown check for same values Pin
Sunasara Imdadhusen21-May-14 23:53
professionalSunasara Imdadhusen21-May-14 23:53 
Questionjavascript Date Issue Pin
wasim khan1-Oct-13 2:20
wasim khan1-Oct-13 2:20 
AnswerRe: javascript Date Issue Pin
Kornfeld Eliyahu Peter6-Oct-13 10:43
professionalKornfeld Eliyahu Peter6-Oct-13 10:43 
GeneralRe: javascript Date Issue Pin
Sunasara Imdadhusen21-May-14 23:54
professionalSunasara Imdadhusen21-May-14 23:54 
QuestionJquery datepicker display for multiple forms Pin
Member 1025344226-Sep-13 22:07
Member 1025344226-Sep-13 22:07 
I have my code structured in such a way that clicking on an 'Edit' button displays a hidden form (written in embedded ruby) within a 'div' html tag and within that form is a text_field_tag whose id is used to tie to a datepicker using Jquery.

Using my current view code and jquery datepicker code in rails : I can click on an edit button and select a date using the text_field_tag for each form. However, when I try to submit that datepicker value it only gets submitted for the first form (for the first 'td element).

Im guessing im doing something wrong with the Jquery code.Can anyone guide me as to how I can submit the datepicker value for the corresponding form (the closest form within 'td' on button click) as opposed to only submitting for the first form(first 'td' element)

Heres my code:

VIEW in RAILS:

<h2>Files</h2>
   <table class="table">
   <tr>
     <th>Filename</th>
     <th>Description</th>
     <th>Download Link</th>
    </tr>
    <% <a href="/Members/files">@files</a>.each do |file| %>
    <% filename = file.split('/').last %>
   <% object = <a href="/Members/bucket">@bucket</a>.objects[file] %>

   <tr>
   <td><%= filename %></td>

   <td>

   <div class="file_description"><%= object.metadata['description']%>

   <button id ="button1" type="button"  class= "btn btn-default
     edit_description"   onclick="Window(this)">Edit</button>

   </div>
    <div id = 'hidden_form' class="file_description_update" >
     <%= form_tag({:action => 'update_file_info'}, multipart: true) do %>
       Update File Description: <%= text_area_tag :description %>
       <%= hidden_field_tag :s3_path, file %>
       <%= hidden_field_tag :prefix, <a href="/Members/prefix">@prefix</a> %>
      <%= text_field_tag 'user_input' %>
       <%= submit_tag 'Submit' %> </td> <br />
     <% end %>
   </div>

   </td>

Code for Jquery in application.js file in Rails:

//= require jquery
     //= require jquery_ujs
     //= require twitter/bootstrap
     //= require bootstrap
     //= require_tree .

     //= require jquery.ui.all
     //= require jquery.ui.datepicker



     $(document).ready(function(){ 
     $( "button.edit_description" ).on( "click", function( event ) { 
     $(this).closest('td').find("div.file_description_update" ).show();
     $(this).closest('td').find("div.file_description_update" 
     ).find('#user_input').datepicker(); 

      });
      });

AnswerRe: Jquery datepicker display for multiple forms Pin
AsWorks1-Oct-13 0:40
AsWorks1-Oct-13 0:40 
Questionhow to get first and last date from selected month from dropdown selected value using javascript Pin
Srinivas Uttareshwar19-Sep-13 2:39
Srinivas Uttareshwar19-Sep-13 2:39 
AnswerRe: how to get first and last date from selected month from dropdown selected value using javascript Pin
jkirkerx20-Sep-13 12:47
professionaljkirkerx20-Sep-13 12:47 
QuestionConnecting/saving to ms sql 2005 database and querying the ms sql database Pin
Otekpo Emmanuel16-Sep-13 14:07
Otekpo Emmanuel16-Sep-13 14:07 
AnswerRe: Connecting/saving to ms sql 2005 database and querying the ms sql database Pin
Richard MacCutchan16-Sep-13 21:04
mveRichard MacCutchan16-Sep-13 21:04 
GeneralRe: Connecting/saving to ms sql 2005 database and querying the ms sql database Pin
Otekpo Emmanuel17-Sep-13 0:29
Otekpo Emmanuel17-Sep-13 0:29 
GeneralRe: Connecting/saving to ms sql 2005 database and querying the ms sql database Pin
Richard Deeming17-Sep-13 1:38
mveRichard Deeming17-Sep-13 1:38 
GeneralRe: Connecting/saving to ms sql 2005 database and querying the ms sql database Pin
Richard MacCutchan17-Sep-13 1:57
mveRichard MacCutchan17-Sep-13 1:57 
GeneralRe: Connecting/saving to ms sql 2005 database and querying the ms sql database Pin
Richard Deeming17-Sep-13 4:28
mveRichard Deeming17-Sep-13 4:28 
GeneralRe: Connecting/saving to ms sql 2005 database and querying the ms sql database Pin
Richard MacCutchan17-Sep-13 4:35
mveRichard MacCutchan17-Sep-13 4:35 
GeneralRe: Connecting/saving to ms sql 2005 database and querying the ms sql database Pin
Richard Deeming17-Sep-13 5:14
mveRichard Deeming17-Sep-13 5:14 
Questioninclude javascript within document write Pin
wfzen16-Sep-13 10:33
wfzen16-Sep-13 10:33 
AnswerRe: include javascript within document write Pin
twseitex25-Sep-13 5:01
twseitex25-Sep-13 5:01 
QuestionHow to call event using javascript? Pin
Sandesh M Patil16-Sep-13 2:49
Sandesh M Patil16-Sep-13 2:49 
AnswerRe: How to call event using javascript? Pin
Richard Deeming16-Sep-13 3:51
mveRichard Deeming16-Sep-13 3:51 
GeneralRe: How to call event using javascript? Pin
Sandesh M Patil16-Sep-13 3:58
Sandesh M Patil16-Sep-13 3:58 
AnswerRe: How to call event using javascript? Pin
Akii Malam1-Oct-13 1:06
Akii Malam1-Oct-13 1:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.