CoryPippen
06-19-2004, 07:19 PM
I am creating an order form, and need something like 1and1 does here: https://order.1and1.com/xml/order/costs;jsessionid=45C70519E55C50824E0B399D8BE2CF0A.TC62b?__frame=
When you click "Business" the form changes (with the user status it does also). How can I do this or does anyone have any code they can share?
For some reason the link takes you to the domain page. Just click next and you will see what I mean.
barrywien
06-19-2004, 07:39 PM
That for uses javascript to create the new field.
The following code replicates it:<script type="text/javascript">
function addcheck(flag)
{
var com1 = document.getElementById("com_switch1");
var com2 = document.getElementById("com_switch2");
var fie = document.getElementById("com_field");
var sel = document.getElementById("mode_company");
com1.style.display = sel.checked ? "" : "none";
com2.style.display = sel.checked ? "" : "none";
fie.disabled = sel.checked ? false : true;
}
</script>
<table cellpadding="0" cellspacing="0"><tr><td style="padding-left:5px;padding-top:5px;"></td><td><input type="radio" id="mode_private" name="newcustomer.Mode" onclick="addcheck(true)" onfocus="if(this.blur)this.blur()" style="vertical-align:middle" value="private" checked><label for="mode_private" style="vertical-align:middle">Personal</label><input type="radio" id="mode_company" name="newcustomer.Mode" onclick="addcheck(true)" onfocus="if(this.blur)this.blur()" style="vertical-align:middle" value="company"><label for="mode_company" style="vertical-align:middle">Business</label></td></tr><tr id="com_switch1"><td>Company name</td><td><input type="text" size="40" maxlength="200" id="com_field" name="newcustomer.Company" value=""></td></tr><tr id="com_switch2"><td colspan="2">Company contact person</td></tr><script type="text/javascript">addcheck();</script>
CoryPippen
06-19-2004, 10:23 PM
Thanks, but the code is not working for me...
barrywien
06-20-2004, 08:20 AM
Copy and paste into notepad and save the page as html, it works but you would have to edit it to suit your own needs.
CoryPippen
06-20-2004, 05:57 PM
Originally posted by barrywien
Copy and paste into notepad and save the page as html, it works but you would have to edit it to suit your own needs.
Are you saying it doesn't work as a .php page? I have tried pasting into dreamweaver (page is html) and it doesn't work. However, it does work if I do what you said. Why is this? How can I add it to my order form?
CoryPippen
06-20-2004, 06:31 PM
Thanks I got the code working (added a closing </table> tag), but I'm still unsure about the status of the code on a .php page?
barrywien
06-20-2004, 07:58 PM
It can be put into a PHP page if you echo it, its not PHP source so theres nothing to parse.