<div class="col-xs-11 col-sm-8 well"> <h2>Database</h2> <p>In order for the system to work properly please choose the correct database below and fill in the credentials.</p> <div class="col-xs-11 col-sm-8"> <div class="radio"> <label class="tip" data-toggle="tooltip" data-placement="right" title="Choose this option if you are using a MySQL database server. This is the most common server for websites"> <input type="radio" name="optionsSQL" id="optionsMySQL" value="mysql" onclick="val_sql()"> MySQL 5.x </label> </div> <div class="radio"> <label class="tip" data-toggle="tooltip" data-placement="right" title="Choose this option if you are using a Microsoft SQL Server or SQL Azure Server. This option is tested on Microsoft SQL Server 2012"> <input type="radio" name="optionsSQL" id="optionsMSSQL" value="mssql" onclick="val_sql()"> Microsoft SQL Server / SQL Azure </label> </div> <div class="radio"> <label class="tip" data-toggle="tooltip" data-placement="right" title="Choose this option if you are using Postgre SQL server. This is one of the options that are rarely used and has not been tested."> <input type="radio" name="optionsSQL" id="optionsPGSQL" value="pgsql" onclick="val_sql()"> PostgreSQL </label> </div> <div class="radio"> <label class="tip" data-toggle="tooltip" data-placement="right" title="Choose this option if you are using SQLite as your database server. This option is recommended only for testing and this system has not been validated to work with SQLite"> <input type="radio" name="optionsSQL" id="optionsSQLite" value="sqlite" onclick="val_sql()"> SQLite 3 and SQLite 2 </label> </div> <div id="MySQL" class="form-hide"> <form name="setDB" action="" method="POST" role="form"> <div class="form-group"> <label for="inputHost">Database Server</label> <input type="text" class="form-control" id="inputHost" value="localhost"> </div> <div class="form-group"> <label for="inputDB">Database</label> <input type="text" class="form-control" id="inputDB"> </div> <div class="form-group"> <label for="inputUser">Database User</label> <input type="text" class="form-control" id="inputUser"> </div> <div class="form-group"> <label for="inputPwd">Database Password</label> <input type="password" class="form-control" id="inputPwd"> </div> <button type="submit" id="lang_submit" name="DBmysql" class="btn btn-primary disabled"><span class="glyphicon glyphicon-circle-arrow-right"></span> Next</button> </form> </div> <div id="MSSQL" class="form-hide"> <form name="setDB" action="" method="POST" role="form"> <div class="form-group"> <label for="inputHost">Database Server</label> <input type="text" class="form-control" id="inputHost" value="localhost"> </div> <div class="form-group"> <label for="inputDB">Database</label> <input type="text" class="form-control" id="inputDB"> </div> <div class="form-group"> <label for="inputUser">Database User</label> <input type="text" class="form-control" id="inputUser"> </div> <div class="form-group"> <label for="inputPwd">Database Password</label> <input type="password" class="form-control" id="inputPwd"> </div> <button type="submit" id="lang_submit" name="DBmssql" class="btn btn-primary disabled"><span class="glyphicon glyphicon-circle-arrow-right"></span> Next</button> </form> </div> <div id="PGSQL" class="form-hide"> <form name="setDB" action="" method="POST" role="form"> <div class="form-group"> <label for="inputHost">Database Server</label> <input type="text" class="form-control" id="inputHost" value="localhost"> </div> <div class="form-group"> <label for="inputDB">Database</label> <input type="text" class="form-control" id="inputDB"> </div> <div class="form-group"> <label for="inputUser">Database User</label> <input type="text" class="form-control" id="inputUser"> </div> <div class="form-group"> <label for="inputPwd">Database Password</label> <input type="password" class="form-control" id="inputPwd"> </div> <button type="submit" id="lang_submit" name="DBpgsql" class="btn btn-primary disabled"><span class="glyphicon glyphicon-circle-arrow-right"></span> Next</button> </form> </div> <div id="SQLite" class="form-hide"> <form name="setDB" action="" method="POST" role="form"> <div class="form-group"> <label for="inputHost">Database Server</label> <input type="text" class="form-control" id="inputHost" value="localhost"> </div> <div class="form-group"> <label for="inputDB">Database</label> <input type="text" class="form-control" id="inputDB"> </div> <div class="form-group"> <label for="inputUser">Database User</label> <input type="text" class="form-control" id="inputUser"> </div> <div class="form-group"> <label for="inputPwd">Database Password</label> <input type="password" class="form-control" id="inputPwd"> </div> <button type="submit" id="lang_submit" name="DBsqlite" class="btn btn-primary disabled"><span class="glyphicon glyphicon-circle-arrow-right"></span> Next</button> </form> </div> </div> </div>
function val_sql() { var sql = $('input[name=optionsSQL]:checked').val(); switch(sql) { case 'mysql': //Show mysql div $("div#mysql").removeClass("form-hide"); break; case 'mssql': //Show mssql div $("div#mssql").removeClass("form-hide"); break; case 'pgsql': //Show pgsql div $("div#pgsql").removeClass("form-hide"); break; case 'sqlite': //Show sqlite div $("div#sqlite").removeClass("form-hide"); break; default: //do nothing break; } }
<div class="col-xs-11 col-sm-8 well"> <h2>Database</h2> <p>In order for the system to work properly please choose the correct database below and fill in the credentials.</p> <div class="col-xs-11 col-sm-8"> <div class="radio"> <label class="tip" data-toggle="tooltip" data-placement="right" title="Choose this option if you are using a MySQL database server. This is the most common server for websites"> <input type="radio" name="optionsSQL" id="optionsMySQL" value="mysql" data-form="form-1"> MySQL 5.x </label> </div> <div class="radio"> <label class="tip" data-toggle="tooltip" data-placement="right" title="Choose this option if you are using a Microsoft SQL Server or SQL Azure Server. This option is tested on Microsoft SQL Server 2012"> <input type="radio" name="optionsSQL" id="optionsMSSQL" value="mssql" data-form="form-2"> Microsoft SQL Server / SQL Azure </label> </div> <div class="radio"> <label class="tip" data-toggle="tooltip" data-placement="right" title="Choose this option if you are using Postgre SQL server. This is one of the options that are rarely used and has not been tested."> <input type="radio" name="optionsSQL" id="optionsPGSQL" value="pgsql" data-form="form-3"> PostgreSQL </label> </div> <div class="radio"> <label class="tip" data-toggle="tooltip" data-placement="right" title="Choose this option if you are using SQLite as your database server. This option is recommended only for testing and this system has not been validated to work with SQLite"> <input type="radio" name="optionsSQL" id="optionsSQLite" value="sqlite" data-form="form-4"> SQLite 3 and SQLite 2 </label> </div> <div id="MySQL" class="form-hide" data-form="form-1"> <form name="setDB" action="" method="POST" role="form"> <div class="form-group"> <label for="inputHost">Database Server</label> <input type="text" class="form-control" id="inputHost" value="localhost"> </div> <div class="form-group"> <label for="inputDB">Database</label> <input type="text" class="form-control" id="inputDB"> </div> <div class="form-group"> <label for="inputUser">Database User</label> <input type="text" class="form-control" id="inputUser"> </div> <div class="form-group"> <label for="inputPwd">Database Password</label> <input type="password" class="form-control" id="inputPwd"> </div> <button type="submit" id="lang_submit" name="DBmysql" class="btn btn-primary disabled"><span class="glyphicon glyphicon-circle-arrow-right"></span> Next</button> </form> </div> <div id="MSSQL" class="form-hide" data-form="form-2"> <form name="setDB" action="" method="POST" role="form"> <div class="form-group"> <label for="inputHost">Database Server</label> <input type="text" class="form-control" id="inputHost" value="localhost"> </div> <div class="form-group"> <label for="inputDB">Database</label> <input type="text" class="form-control" id="inputDB"> </div> <div class="form-group"> <label for="inputUser">Database User</label> <input type="text" class="form-control" id="inputUser"> </div> <div class="form-group"> <label for="inputPwd">Database Password</label> <input type="password" class="form-control" id="inputPwd"> </div> <button type="submit" id="lang_submit" name="DBmssql" class="btn btn-primary disabled"><span class="glyphicon glyphicon-circle-arrow-right"></span> Next</button> </form> </div> <div id="PGSQL" class="form-hide" data-form="form-3"> <form name="setDB" action="" method="POST" role="form"> <div class="form-group"> <label for="inputHost">Database Server</label> <input type="text" class="form-control" id="inputHost" value="localhost"> </div> <div class="form-group"> <label for="inputDB">Database</label> <input type="text" class="form-control" id="inputDB"> </div> <div class="form-group"> <label for="inputUser">Database User</label> <input type="text" class="form-control" id="inputUser"> </div> <div class="form-group"> <label for="inputPwd">Database Password</label> <input type="password" class="form-control" id="inputPwd"> </div> <button type="submit" id="lang_submit" name="DBpgsql" class="btn btn-primary disabled"><span class="glyphicon glyphicon-circle-arrow-right"></span> Next</button> </form> </div> <div id="SQLite" class="form-hide" data-form="form-4"> <form name="setDB" action="" method="POST" role="form"> <div class="form-group"> <label for="inputHost">Database Server</label> <input type="text" class="form-control" id="inputHost" value="localhost"> </div> <div class="form-group"> <label for="inputDB">Database</label> <input type="text" class="form-control" id="inputDB"> </div> <div class="form-group"> <label for="inputUser">Database User</label> <input type="text" class="form-control" id="inputUser"> </div> <div class="form-group"> <label for="inputPwd">Database Password</label> <input type="password" class="form-control" id="inputPwd"> </div> <button type="submit" id="lang_submit" name="DBsqlite" class="btn btn-primary disabled"><span class="glyphicon glyphicon-circle-arrow-right"></span> Next</button> </form> </div> </div> </div>
$(function(){ $("div.radio input[type=radio]").on("change", function(){ $("div[data-form]").addClass("form-hide"); $("div[data-form="+$(this).data("form")+"]").removeClass("form-hide"); }); });