You are viewing limited content. For full access, please sign in.

Question

Question

Set Different Value for Row Fields in Each Row?

asked on April 9, 2015

We have a need to create a table that will take information like this screenshot:

I need to be able to have a set number of rows in the table (which is easy to do through the interface), but I need to set the next row to have Grade set to Kindergarten and Season to Winter. Then the next row Grade set to Kindergarten and Season set to Spring. The row after that would change the Grade to 1st and set the Season to Fall.

I imagine this has to be done using JavaScript, but I'm not sure how to go about it. Any help would greatly help.

0 0

Answer

SELECTED ANSWER
replied on April 9, 2015 Show version history

Hi Blake,

Are you having trouble with arrays or addressing the fields? Here's some code for addressing the fields:


$(document).ready(function () {
  
  $('#q1 tr:eq(1) td:eq(1) input').val('Kindergarten');
  $('#q1 tr:eq(1) td:eq(2) input').val('Fall');
  $('#q1 tr:eq(2) td:eq(1) input').val('Kindergarten');
  $('#q1 tr:eq(2) td:eq(2) input').val('Winter is coming');
  $('#q1 tr:eq(3) td:eq(1) input').val('Kindergarten');
  $('#q1 tr:eq(3) td:eq(2) input').val('Spring');
  $('#q1 tr:eq(4) td:eq(1) input').val('Kindergarten');
  $('#q1 tr:eq(4) td:eq(2) input').val('Summer');
  $('#q1 tr:eq(5) td:eq(1) input').val('1st');
  $('#q1 tr:eq(5) td:eq(2) input').val('Fall');
});

 

0 0
replied on April 10, 2015

Ben, thank you for that. It's exactly what I needed to see if that's the way I want to go.

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.