...

View Full Version : Dinamic Form



aspitzer
01-17-2003, 11:53 AM
Hi,

I need to create a form like hotmail's registration one..you know?

Its a hotels reservation form. I need the form to autochange when the hotel is selected.

Anyone can give any clue, link tutorial or example??
Thanks In advance

Andres

Adam20002
01-17-2003, 12:21 PM
Hi,

Not really sure what you need but i would recommend reading up on the DOM for dynamically creating elements.

heres a good tutorial to start.

http://www.brainjar.com/dhtml/intro

Adam

arnyinc
01-17-2003, 02:47 PM
If the form is fairly long you'd be better off having the user enter some basic information (including the hotel) then continuing to another page based on which hotel they chose.

To answer your question, it's really easy to do this in IE, but Netscape and other browsers don't like it. This example works on NS4+ and IE, but requires absolute positioning.



<html>
<head>
<script language="javascript">
function showhide(checkval){
var colData = "Here is my hidden text.";
if (document.layers){
document.layers['mylayer'].document.open();
document.layers['mylayer'].document.write("<form name='mylayer'>");
document.layers['mylayer'].document.write(colData);
document.layers['mylayer'].document.write("</form>");
document.layers['mylayer'].document.close();
document.layers['mylayer'].visibility=(checkval=="hide") ? 'hide' : "show";
}
else{
document.all['mylayer'].style.visibility=(checkval=="hide") ? 'hidden' :"visible";
document.all.mylayer.innerHTML = colData;
}
}
</script>
</head>
<body>
<form>
<select name="myfield" onchange="showhide(this[this.selectedIndex].text);">
<option>hide</option>
<option>show</option>
</select>
</form>
<div id='mylayer' style="position:absolute;left:10px;top:500px">&nbsp;</div>
</body>
</html>

Vladdy
01-18-2003, 01:27 AM
You are welcome to draw inspiration from a dynamic form I created for a car rental business (https://gh.cartmedia.com/SSL34781/rsrvtst/reservations.html). Hotel reservations should not be that much different...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum