acesites Posted August 15, 2012 Share Posted August 15, 2012 Hi I have a table that shows a list of results and a script that runs when the complete button is pressed on a result ( it allows to enter a name before confirming the result) It al works great when clicking the button on the first result in the table but wont work for any other result? Hope someone can help <script> function requestRepairedBy() { var repaired_by = prompt('Name of repairer'); if (repaired_by != null && repaired_by != "") { document.getElementById('repaired_by').value = repaired_by; } else { alert("Invalid repairer name"); return false; } } </script> <form method="post" action="warehouse_summary.php?warehouse_id=<?php echo $warehouse_id; ?>&report_id=<?php echo $db_report_id;?>" onsubmit="return requestRepairedBy()" /> <input type="hidden" name="repaired_by" id="repaired_by" /> <tr> <td><a href="entrydisplay.php?report_id=<?php echo $db_report_id; ?>"><?php echo $db_dam_location; ?></a></td> <td><?php if($damage_level1 == 0){ echo ''; } else { echo $damage_level1; } ?></td> <td><?php if($damage_level2 == 0){ echo ''; } else { echo $damage_level2; } ?></td> <td><?php if($damage_level3 == 0){ echo ''; } else { echo $damage_level3; } ?></td> <td><?php if($damage_level5 == 0){ echo ''; } else { echo $damage_level5; } ?></td> <td><?php if($damage_level6 == 0){ echo ''; } else { echo $damage_level6; } ?></td> <td><?php if($damage_level7 == 0){ echo ''; } else { echo $damage_level7; } ?></td> <td><?php if($damage_level9 == 0){ echo ''; } else { echo $damage_level9; } ?></td> <td><?php if($damage_level10 == 0){ echo ''; } else { echo $damage_level10; } ?></td> <td><?php if($damage_level12 == 0){ echo ''; } else { echo $damage_level12; } ?></td> <td><?php if($damage_level11 == 0){ echo ''; } else { echo $damage_level11; } ?></td> <td><?php if($damage_level14 == 0){ echo ''; } else { echo $damage_level14; } ?></td> <td><?php if($damage_level13 == 0){ echo ''; } else { echo $damage_level13; } ?></td> <td><?php if($damage_level15 == 0){ echo ''; } else { echo $damage_level15; } ?></td> <td><?php if($damage_level16 == 0){ echo ''; } else { echo $damage_level16; } ?></td> <td><?php echo $db_damage_comment; ?></td> <td><?php echo $db_components; ?></td> <td><?php echo $locationEmpty; ?></td> <td><?php echo $db_no_positions; ?></td> <td><input type="submit" value="Complete" class="submitbutton" name="save" /></td> </tr> </form> Quote Link to comment https://forums.phpfreaks.com/topic/267137-function-request-not-working-help-for-newbie-pleaseeee/ Share on other sites More sharing options...
requinix Posted August 15, 2012 Share Posted August 15, 2012 Because you have multiple forms with the same ID. Which isn't valid because IDs are supposed to be unique. Also, FORMs are not valid directly inside TABLE tags. Quote Link to comment https://forums.phpfreaks.com/topic/267137-function-request-not-working-help-for-newbie-pleaseeee/#findComment-1369747 Share on other sites More sharing options...
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.