[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1395
  • Last Modified:

Grey out an entire table row - php/javascript

Hi,
I have a php page where I query the database and generate a table to display the results. Now in the table, on clicking an element I want to grey out that row.
code snippet for the table
echo "<table><tr>
                                        <th>Exclude</th>
&#9;&#9;&#9;&#9;&#9;<th>Hospital</th>
&#9;&#9;&#9;&#9;&#9;<th>Patient</th>
&#9;&#9;&#9;&#9;&#9;<th>NS</th>
&#9;&#9;&#9;&#9;&#9;<th>MRN</th>
&#9;&#9;&#9;&#9;</tr>";
<?

for($i=0; $i < 10; $i++){
?>
            <tr>
              <th align="left" class="form-matrix-row-headers" nowrap="nowrap">
                <? echo $i+1;?>
              </th>
              <td align="center" class="form-matrix-values">
                <input class="form-textbox" type="text" size="5" name="qt6_clickPatient[<? echo $i;?>][]" />
              </td>
              <td align="center" class="form-matrix-values">
                <input class="form-textbox" type="text" size="5" value = <? echo $census_report[$i]["Bed"];?> name="qt6_clickPatient[<? echo $i;?>][]" />
              </td>
              <td align="center" class="form-matrix-values">
                <input class="form-textbox" type="text" size="5" value = <? echo $census_report[$i]["Patient"];?> name="qt6_clickPatient[<? echo $i;?>][]" />
              </td>
<?
}
?>

Open in new window


Now if I click on patient name both bed and patient name should be greyed out, indicating that this record has been disabled for further processing, and a check mark appear under exclude.
Appreciate any help.
I have a javascript which fires up on onChange event
     document.getElementById("Patient").disabled = true;
But this does not work as the records are inside a for loop and in an array.
Thanks,
0
Mohit_t
Asked:
Mohit_t
  • 3
  • 3
1 Solution
 
leakim971PluritechnicianCommented:
0
 
Mohit_tAuthor Commented:
Hi leakim971,
Thanks for the quick response. I was caught up in other development activities so could not reply earlier. I implemented your solution, this works fine in IE but not in FF or Chrome. Appreciate if you can help me make it cross-browser compatible.
Also I need to be able to toggle i.e. once greyed out I also need to re-enable the cells by clicking on the table row, this was not there in my original post.

Thanks,
0
 
Mohit_tAuthor Commented:
Appreciate any comments / solutions/ inputs on this question
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
leakim971PluritechnicianCommented:
the solution work fine for me on FF and Chrome
0
 
Mohit_tAuthor Commented:
Hi  leakim971,
In IE 9 the solution works correctly I choose some table rows and they are greyed out and on submission of the form, I don't see the greyed out records on the next page.
In Chrome 27.0.x, table rows are greyed but on form submission, I see the greyed out results also on the next page.
In FF 21.0 nothing happens on clicking the table rows.
Seems like both FF and chrome behave differently to the same code, there  might be some browser specific adjustments that need to be made.
Also how can we make this toggle between greying out the table rows and deselecting the greyed out rows when it is clicked again.
Could there be a solution for this in jquery, I have not used jquery very much so not sure of a solutio in jquery.
 
Thanks
0
 
leakim971PluritechnicianCommented:
I don't see the greyed out records on the next page
Why do you think you will see them greyed on the next page?

In FF 21.0 nothing happens on clicking the table rows.
Not mine :
on FF 21
Look like we're not working on the same code? You should confirm the jsfiddle work for you first between integrating the code in your webpage and saying it don't work but perhaps I miss something?
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now