![]() |
|
|
|||||||
| Register | Forum FAQ | Search | Today's Posts | Mark Forums Read |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
php form and processor:
PHP Code:
|
|
||||
|
Good luck with the smoking. Its a wonderful thing when you finally do. Takes a LONG time.....
OK..... lets start with company name. OK - Part One of the lesson: Step one is to label the area where company name will display so in the area of your 'card preview template' this: HTML Code:
<td rowspan="2">company_name </td> HTML Code:
<td rowspan="2" id="companyName">company_name </td> Note that javascript does not deal with underscores, which is why I changed the id to be different than tour form var name. Next on the input field: before: HTML Code:
<td><input name="company_name" type="text" id="company_name" tabindex="5" size="25" maxlength="50" /></td> HTML Code:
<td><input name="company_name" type="text" id="company_name" tabindex="5" size="25" maxlength="50" onChange="document.getElementById('companyName').innerHTML=this.value;" /></td> This instructs the browser to run this javascript whenever the data is changed and the focus leaves that field. This is the cell we just labelled document.getElementById('companyName') This is the data that was entered this.value ... and this takes that data and sticks it in the table cell document.getElementById('companyName').innerHTML=t his.value;" Simple eh? (G) Some gotchas to observe. Watch out for textarea. Linefeeds will need to be converted to break tags, and that gets tricky. PHP handles underscores, Javascript does not. So there should be none in the id= attributes. |
|
||||
|
Colors, which will lead to graphics, I am sure, since you labelled them 'Image'.
First, we need to id what we want to modify before: HTML Code:
<table width="350" height="200" border="0" align="center" cellpadding="0" cellspacing="10" background="<background selection>">
HTML Code:
<table id=cardTemplate width="350" height="200" border="0" align="center" cellpadding="0" cellspacing="10">
Now the radio buttons. This is where CSS comes into play. FYI, you surrounded them with the label tag which disabled them before HTML Code:
<td><label> <input name="radiobutton" type="radio" value="radiobutton" tabindex="1"/> Blue Image <input name="radiobutton" type="radio" value="radiobutton" tabindex="2" /> Red Image<br /> <input name="radiobutton" type="radio" value="radiobutton" tabindex="3" /> Purple Image <input name="radiobutton" type="radio" value="radiobutton" tabindex="4" /> No Image</label></td> HTML Code:
<td> <input name="radiobutton" type="radio" value="blue" tabindex="1" onChange="document.getElementById('cardTemplate').style.backgroundColor=this.value"/> Blue Image <input name="radiobutton" type="radio" value="red" tabindex="2" onChange="document.getElementById('cardTemplate').style.backgroundColor=this.value"/> Red Image<br /> <input name="radiobutton" type="radio" value="purple" tabindex="3" onChange="document.getElementById('cardTemplate').style.backgroundColor=this.value"/> Purple Image <input name="radiobutton" type="radio" value="transparent" tabindex="4" onChange="document.getElementById('cardTemplate').style.backgroundColor=this.value"/> No Image</td> .style.backgroundColor references the background color of the card template |
|
||||
|
Question:
When I updated the rest of the onChange for the text fields - they did not work...am I jumping ahead or ? Here's my code so far with the corrections for the label tags and adding color codes: HTML Code:
<html xmlns="XHTML namespace"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <form action="formprocessor2.php" method="POST"><table width="100%" border="0" cellspacing="10" cellpadding="0"> <tr> <td>Customer Input Section - all info is optional </td> <td width="50%">Design Preview </td> </tr> <tr> <td width="50%"><table width="202%" border="0" cellspacing="10" cellpadding="0"> <tr> <td>Background Selection </td> <td> <input name="radiobutton" type="radio" value="#345ea9" tabindex="1" onChange="document.getElementById('cardTemplate').style.backgroundColor=this.value" /> Blue Image <input name="radiobutton" type="radio" value="#FF0000" tabindex="2" onChange="document.getElementById('cardTemplate').style.backgroundColor=this.value" /> Red Image<br /> <input name="radiobutton" type="radio" value="#9900FF" tabindex="3" onChange="document.getElementById('cardTemplate').style.backgroundColor=this.value" /> Purple Image <input name="radiobutton" type="radio" value="#ffffff" tabindex="4" onChange="document.getElementById('cardTemplate').style.backgroundColor=this.value" /> No Image</td> </tr> <tr> <td>Company Name </td> <td><input name="company_name" type="text" id="company_name" tabindex="5" size="25" maxlength="50" onChange="document.getElementById('companyName').innerHTML=this.value;" /></td> </tr> <tr> <td>Slogan</td> <td><input name="slogan" type="text" id="slogan" tabindex="6" size="25" maxlength="100" onChange="document.getElementById('slogan').innerHTML=this.value;" /></td> </tr> <tr> <td>Full Name </td> <td><input name="name" type="text" id="name" tabindex="7" size="25" maxlength="50" onChange="document.getElementById('name').innerHTML=this.value;" /></td> </tr> <tr> <td>Job Title </td> <td><input name="title" type="text" id="title" tabindex="8" size="25" maxlength="25" onChange="document.getElementById('title').innerHTML=this.value;" /></td> </tr> <tr> <td>Address - Line 1 </td> <td><input name="address_1" type="text" id="address_1" tabindex="9" size="25" maxlength="100" onChange="document.getElementById('address1').innerHTML=this.value;" /></td> </tr> <tr> <td>Address - Line 2 </td> <td><input name="address_2" type="text" id="address_2" tabindex="10" size="25" maxlength="100" onChange="document.getElementById('address2').innerHTML=this.value;" /></td> </tr> <tr> <td>Address - Line 3 </td> <td><input name="address_3" type="text" id="address_3" tabindex="11" size="25" maxlength="100" onChange="document.getElementById('address3').innerHTML=this.value;" /></td> </tr> <tr> <td>Telephone</td> <td><input name="phone" type="text" id="phone" tabindex="12" size="25" maxlength="15" onChange="document.getElementById('phone').innerHTML=this.value;" /></td> </tr> <tr> <td>Cell </td> <td><input name="cell" type="text" id="cell" tabindex="13" size="25" maxlength="15" onChange="document.getElementById('cell').innerHTML=this.value;" /></td> </tr> <tr> <td>Fax</td> <td><input name="fax" type="text" id="fax" tabindex="14" size="25" maxlength="15" onChange="document.getElementById('fax').innerHTML=this.value;" /></td> </tr> <tr> <td>e-mail Address </td> <td><input name="vis_email" type="text" id="vis_email" tabindex="15" size="25" maxlength="50" onChange="document.getElementById('email').innerHTML=this.value;" /></td> </tr> <tr> <td>Website Address </td> <td><input name="website" type="text" id="website" tabindex="16" size="25" maxlength="100" onChange="document.getElementById('website').innerHTML=this.value;" /></td> </tr> <tr> <td>Additional Info </td> <td><input name="add_info" type="text" id="add_info" tabindex="17" size="25" maxlength="100" onChange="document.getElementById('addInfo').innerHTML=this.value;" /></td> </tr> <tr> <td><label></label></td> <td> </td> </tr> </table> </td> <td width="50%" align="center" valign="top"><table id=cardTemplate width="350" height="200" border="0" align="center" cellpadding="0" cellspacing="10"> <tr> <td rowspan="2" id="companyName">company_name </td> <td id="name"><div align="right">name</div></td> </tr> <tr> <td id="title"><div align="right">title</div></td> </tr> <tr> <td colspan="2" align="center" id="slogan">slogan</td> </tr> <tr> <td id="address1">address_1</td> <td align="right" id="phone">phone</td> </tr> <tr> <td id="address2">address_2</td> <td align="right" id="cell">cell</td> </tr> <tr> <td id="address3">address_3</td> <td align="right" id="fax">fax</td> </tr> <tr> <td id="website">website</td> <td align="right" id="email">• vis_email </td> </tr> <tr> <td colspan="2" align="center" id="addInfo">add_info</td> </tr> </table> <br /> <label> <input name="approval" type="checkbox" id="approval" value="approve" /> </label> I approve Design! (required)<br /> <br /> <input type="submit" name="Submit" value="Submit Design!" /></td> </tr> </table> </form> </body> </html> Last edited by rlhanson; 10-25-2007 at 02:21 PM. |