Ok, voy avanzando ya funciona a medias.
Os muestro los archivos:
Código Javascript
:
Ver original<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Aircrafts</title>
<link rel="stylesheet" type="text/css" href="./css/style.css">
<link rel="stylesheet" href="./css/flick/jquery.ui.all.css">
<script src="./jquery.js"></script>
<script src="./ui/jquery.ui.core.js"></script>
<script src="./ui/jquery.ui.widget.js"></script>
<script src="./ui/jquery.ui.button.js"></script>
<script src="./ui/jquery.ui.core.js"></script>
<script src="./ui/jquery.ui.widget.js"></script>
<script src="./ui/jquery.ui.mouse.js"></script>
<script src="./ui/jquery.ui.button.js"></script>
<script src="./ui/jquery.ui.draggable.js"></script>
<script src="./ui/jquery.ui.position.js"></script>
<script src="./ui/jquery.ui.resizable.js"></script>
<script src="./ui/jquery.ui.dialog.js"></script>
<script src="./ui/jquery.ui.effect.js"></script>
<script>
$.fx.speeds._default = 1000;
$(function() {
$( "#dialog" ).dialog({
autoOpen: false,
show: "blind",
hide: "explode"
});
$( "#insertaircraft" ).click(function() {
$( "#dialog" ).dialog( "open" );
return false;
});
});
</script>
<div id="dialog" title="Basic dialog">
<?php include('./new_aircraft.php'); ?>
</div>
<tr><td></td><td><input id="insertaircraft" type="submit" value="Insert Aircraft"/></td></tr>
</head>
<body>
</body>
</html>
y el new_aircraft.php
Código Javascript
:
Ver original<script>
$(function() {
$("#insertaircraft2")
.button()
.click(function(event) {
});
});
</script>
<form action="new_aircraft_process.php" method="post" enctype="application/x-www-form-urlencoded">
<table>
<tr><td class="forms">ICAO:</td><td><input maxlength="4" type="text" name="icao" size="30"/></td></tr>
<tr><td class="forms">Name:</td><td><input type="text" name="name" size="30"/></td></tr>
<tr><td class="forms">Weight Empty: </td><td><input type="text" name="weightempty" size="30"/></td></tr>
<tr><td class="forms">Weight Full: </td><td><input type="text" name="weightfull" size="30"/></td></tr>
<tr><td class="forms">Cargo Full: </td><td><input type="text" name="cargofull" size="30"/></td></tr>
<tr><td class="forms">Cruise Speed: </td><td><input type="text" name="cruisespeed" size="30"/></td></tr>
<tr><td class="forms">Range: </td><td><input type="text" name="range" size="30"/></td></tr>
<tr><td class="forms">Price: </td><td><input type="text" name="price" size="30"/></td></tr>
<tr><td class="forms">Number Classes:</td><td><select name="numberclasses" id="numberclasses">
<option value="0">Select Number of Classes</option>
<?php
echo '<option value="1">One Classes (Economy)</option>';
echo '<option value="2">Two Classes (Business & Economy)</option>';
echo '<option value="3">Three Classes (First, Business & Economy)</option>';
?>
</select></td></tr>
<tr><td class="forms">First Class:</td><td><input disabled="disabled" type="text" id="firstclassseats" name="firstclassseats" size="30"/></td></tr>
<tr><td class="forms">Business Class:</td><td><input disabled="disabled" type="text" id="businessclassseats" name="businessclassseats" size="30"/></td></tr>
<tr><td class="forms">Economy Class:</td><td><input disabled="disabled" type="text" id="economyclassseats" name="economyclassseats" size="30"/></td></tr>
<script type="text/javascript">
$("#numberclasses").change(function() {
value = $(this).val();
$("div").text(value);
str = parseInt(value);
switch(str)
{
case 0:
$(document).ready(function() {
$("#firstclassseats").attr("disabled","disabled");
$("#businessclassseats").attr("disabled","disabled");
$("#economyclassseats").attr("disabled","disabled");
});
break;
case 1:
$(document).ready(function() {
$("#economyclassseats").removeAttr('disabled');
$("#firstclassseats").attr("disabled","disabled");
$("#businessclassseats").attr("disabled","disabled");
});
break;
case 2:
$(document).ready(function() {
$("#businessclassseats").removeAttr('disabled');
$("#economyclassseats").removeAttr('disabled');
$("#firstclassseats").attr("disabled","disabled");
});
break;
case 3:
$(document).ready(function() {
$("#firstclassseats").removeAttr('disabled');
$("#businessclassseats").removeAttr('disabled');
$("#economyclassseats").removeAttr('disabled');
});
break;
}
});
</script>
<tr><td></td><td><input id="insertaircraft2" type="submit" value="Insert Submit"/></td></tr>
</table>
</form>
El problema es que cuando selecciono la respuesta del Select de new_aircraft cuando se está ejecutando en el dialog, al escoger la respuesta el dialog se cierra.
PD: Si en vez de las etiquetas <div> las cambio por <th>, el script no da problema pero ya aparece en la pantalla fuera de dialog.