mdc101 15 Posted January 4, 2014 Report Share Posted January 4, 2014 HI Experts I need some assistance.Been sitting for hours trying to figure out how to do this. I have 3 tables with ids. (id="table_1")I need to check all the check boxes in say id="table_2" but not in id="table_1" or id="table_3" before a form is submitted. Does anyone know how this can be done?Any help would be appreciated Thanks in advance for any suggestions example <table class="info_table" id="table_1" style="margin-bottom: 1em; display: none"> <tr> <td><input name="themes[84412]" type="hidden" value="f"><input id="themes_84412" name="themes[84412]" onclick="check_total_silos(this);" type="checkbox" value="t"></td> <td> </tr></table> <table class="info_table" id="table_2" style="margin-bottom: 1em; display: none"> <tr> <td><input name="themes[84413]" type="hidden" value="f"><input id="themes_84413" name="themes[84413]" onclick="check_total_silos(this);" type="checkbox" value="t"></td> <td> </tr> <tr> <td><input name="themes[84415]" type="hidden" value="f"><input id="themes_84415" name="themes[84415]" onclick="check_total_silos(this);" type="checkbox" value="t"></td> <td> </tr> <tr> <td><input name="themes[84418]" type="hidden" value="f"><input id="themes_84418" name="themes[84418]" onclick="check_total_silos(this);" type="checkbox" value="t"></td> <td> </tr></table> <table class="info_table" id="table_3" style="margin-bottom: 1em; display: none"> <tr> <td><input name="themes[84414]" type="hidden" value="f"><input id="themes_84414" name="themes[84414]" onclick="check_total_silos(this);" type="checkbox" value="t"></td> <td> </tr></table> Quote Link to post Share on other sites
mdc101 15 Posted January 6, 2014 Author Report Share Posted January 6, 2014 wow no replies!! Quote Link to post Share on other sites
Steve 30 Posted January 6, 2014 Report Share Posted January 6, 2014 Here's one way you can do it:(what the following example is doing is first scraping the HTML of the target table, then it scrapes all of the checkbox ID's into a list, and then loops through that list checking each one) Enjoy! load html("<table class=\"info_table\" id=\"table_1\" style=\"margin-bottom: 1em; display: block\"> <tr> <td><input name=\"themes[84412]\" type=\"hidden\" value=\"f\"><input id=\"themes_84412\" name=\"themes[84412]\" onclick=\"check_total_silos(this);\" type=\"checkbox\" value=\"t\"></td> <td> </tr> </table> <table class=\"info_table\" id=\"table_2\" style=\"margin-bottom: 1em; display: block\"> <tr> <td><input name=\"themes[84413]\" type=\"hidden\" value=\"f\"><input id=\"themes_84413\" name=\"themes[84413]\" onclick=\"check_total_silos(this);\" type=\"checkbox\" value=\"t\"></td> <td> </tr> <tr> <td><input name=\"themes[84415]\" type=\"hidden\" value=\"f\"><input id=\"themes_84415\" name=\"themes[84415]\" onclick=\"check_total_silos(this);\" type=\"checkbox\" value=\"t\"></td> <td> </tr> <tr> <td><input name=\"themes[84418]\" type=\"hidden\" value=\"f\"><input id=\"themes_84418\" name=\"themes[84418]\" onclick=\"check_total_silos(this);\" type=\"checkbox\" value=\"t\"></td> <td> </tr> </table> <table class=\"info_table\" id=\"table_3\" style=\"margin-bottom: 1em; display: block\"> <tr> <td><input name=\"themes[84414]\" type=\"hidden\" value=\"f\"><input id=\"themes_84414\" name=\"themes[84414]\" onclick=\"check_total_silos(this);\" type=\"checkbox\" value=\"t\"></td> <td> </tr> </table>") set(#table_id, "table_2", "Global") set(#focus_on_this_table, $scrape attribute(<id=#table_id>, "outerhtml"), "Global") clear list(%checkbox_ids) add list to list(%checkbox_ids, $find regular expression(#focus_on_this_table, "(?<=id\\=\\\").+(?=\\\"\\ name)"), "Delete", "Global") loop($list total(%checkbox_ids)) { change checkbox(<id=$next list item(%checkbox_ids)>, "Checked") } checkbox_example.ubot 1 Quote Link to post Share on other sites
Steve 30 Posted January 8, 2014 Report Share Posted January 8, 2014 Did this help you? Quote Link to post Share on other sites
mdc101 15 Posted January 24, 2014 Author Report Share Posted January 24, 2014 Thanks that worked Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.