javascript - Generate report from form to confirm before submit -


i have form checkboxes (in fact radio buttons instead of checkboxes). want create report list of checked options. report should confirmed befor submit form. how this? there 2 other functions in code. form looks similar form below

<form method="post" action="add.php" onsubmit="return otherfunction();">   <?php  while($linia=mysql_fetch_array($result)){    echo "<tr><td>".$linia['description']."</td><td><input type='radio' name='check".$i."' value='1' onclick='activefunction(".$i.")'><input type='hidden' name='vcheck".$i."' value='".$linia['id_description']."'></td>";	  }  <button type='submit'>send form</button>  ?>

i need work that: checks of radio buttons click submit person should see checked options read , confirm if there no mistakes ex. he/she didn't check 1 of options wanted

i place function-call on button this:

<button onclick="otherfunction()">send form</button> <script> function otherfunction() {     if (confirm('sure want submit form?')) {          // you'd have give form id 'myform' first          document.getelementbyid('myform').submit();     }     else {          // not sending form, maybe else here     }  } </script> 

your form-tag should this:

<form method="post" action="add.php" id="myform"> 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -