visitor Posted November 10, 2010 Share Posted November 10, 2010 Hi Guys I would like to have the error message (mandatory fields * are...) to show up only if one of those mandatory fields isn't filled out. Have you got an idea what's wrong with this script? Any help would be highly appreciated. Cheers, visitor <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de-ch" lang="de-ch"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="Stylesheet" href="styles.css" /> </head> <body> <div id="main_cont"> <div id="title"> <img src="ZEIT8.jpg" alt="" /></div> <div id="content"> <?php> <span id="error">MANDATORY FIELDS * ARE: ISIN, CURRENCY, CUSTODY A/C, QUANTITY, T/D, V/D, SELLER, CUSTODIAN</span><br /><br /><script> function SetValues(id,number) { var Ids = new Array(); var Currency = new Array(); var Names = new Array(); Ids[1] = "1";Currency[1] = "USD";Names[1] = "FIDELITY ASIAN";Ids[2] = "2";Currency[2] = "GBP";Names[2] = "LEO SMALL PEARL";Ids[3] = "3";Currency[3] = "EUR";Names[3] = "VONTOBEL CLASSIC";Ids[4] = "4";Currency[4] = "JPY";Names[4] = "HSBC TECHNOLOGY";Ids[41] = "5";Currency[5] = "JPY";Names[5] = "OPPENHEIM EASTERN EUROPE";if(Ids[id]) if(number=='0'){ document.getElementById('Currency').value = Currency[id]; document.getElementById('Name').value = Names[id]; } if(id==0) if(number=='0'){ document.getElementById('Currency').value = 'Select ISIN'; document.getElementById('Name').value = 'Select ISIN'; } } function verify() { var message = ''; if(document.getElementById('Quantity').value) if(!(document.getElementById('Quantity').value == parseInt(document.getElementById('Quantity').value))) message = message + 'QUANTITY MUST BE NUMERIC!'; reZip = new RegExp(/(^\d{4}-\d{2}-\d{2}$)|(^$)/); if(!reZip.test(document.getElementById('Trade_Date').value)) message = message + '\nTRADE DATE FORMAT MUST BE YYYY-MM-DD !'; if(!reZip.test(document.getElementById('Settlement_Date').value)) message = message + '\nSETTLEMENT DATE FORMAT MUST BE YYYY-MM-DD !'; if(!message) document.createT.submit(); else { alert(message); return false;} } function switc(val) { document.getElementById('xxx').style.visibility = (val == 'switch') ? 'visible' : 'hidden'; if(val!='switch') document.getElementById('amount2').value='0'; return false; } </script> <form name="createT" method="post" action=""> <input type='hidden' name='type' value='purchase'/> <div> <fieldset> <legend>FUND DETAILS</legend> <table border=0> <tr> <td align="right"><span style='color:#FF0000'>ISIN*</span></td> <td> <select name='security1' onchange='SetValues(this.value,"0")'> <option value='0'> selection</option> <option value='1'>LU.000'000'000'0</option> <option value='2'>CH.111'111'111'1</option> <option value='3'>DE.222'222'222'2</option> <option value='4'>US.333'333'333'3</option> <option value='5'>KY.444'444'444'4</option> </select> </td> <td align="right"><span style='color:#FF0000'>CURRENCY*</span></td> <td><select name="currency" id="currency" class="dropdown"> <option value="">selection</option> <option value="1">USD</option> <option value='2'>EUR</option> <option value='3'>GBP</option> <option value='4'>JPY</option> <option value='5'>CHF</option> </select> </td> </tr> <tr> <td colspan="4"> <div class='notification'>IF ISIN IS NOT IN THE DATABASE, JUST ADD IT IN THE "REMARKS" FIELD</div> </td> </tr> <tr> <td align="right">FUND NAME</td> <td colspan="3"> <input class="norm" type="text" size="61" name="Name" id="Name" /></div> </td> </tr> <tr> <td align="right"><span style='color:#FF0000'>QUANTITY*</span></td> <td> <input class="norm" type="text" name="Quantity" id="Quantity" /></div> </td> <td><span style='color:#FF0000'>CUSTODY A/C*</span></td> <td><select name="client" id="client" class="dropdown"> <option value=""> selection</option> <option value="1">S1 (REG.)</option> <option value='2'>S2 (RESTR.)</option> <option value='3'>S3 (U.S.)</option> </select> </td> </tr> <tr> <td align="right"><span style='color:#FF0000'>TRADE DATE*</span></td> <td> <input class="norm" type="text" name="Trade_Date" id="Trade_Date" /></div> </td> <td align="right"><span style='color:#FF0000'>VALUE DATE*</span></td> <td> <input class="norm" type="text" name="Settlement_Date" id="Settlement_Date" /></div> </td> </table> </fieldset> </div> <br /> <div> <fieldset> <legend>SELLER DETAILS</legend> <table> <tr> <td align="right"><span style='color:#FF0000'>SELLER*</span></td> <td colspan="4"> <input class="norm" type="text" size="58" name="Partner" id="Partner" /></div> </td> </tr> <tr> <td align="right">BIC (SELLER)</td> <td> <input class="norm" type="text" name="BIC_Partner" id="BIC_Partner" /></div> </td> <td width="220px" align="right"> </td> </tr> <tr> <td align="right"><span style='color:#FF0000'>CUSTODIAN*</span></td> <td colspan="4"> <input class="norm" type="text" size="58" name="Custodian" id="Custodian" /></div> </td> </tr> <tr> <td align="right">BIC (CUSTODIAN)</td> <td> <input class="norm" type="text" name="Custodian_BIC" id="Custodian_BIC" /></div> </td> </tr> <tr> <td align="right">CLIENT A/C WITH CUST.</td> <td><input class="norm" type="text" name="client_ac_cust" id="client_ac_cust" value=""/></td> </tr> <tr> <td align="right">TRANSFER AGENT</td> <td colspan="4"> <input class="norm" type="text" size="58" name="TA_Name" id="TA_Name" /></div></td> </tr> <tr> <td align="right">BIC (TA)</td> <td><input class="norm" type="text" name="TA_BIC" id="TA_BIC" /></div></td> </tr> <tr> <td align="right">CUSTODIAN A/C WITH T/A</td> <td><input class="norm" type="text" name="cust_ac_ta" id="cust_ac_ta" value=""/></td> </tr> <tr> <td align="right">REMARKS</td> <td colspan="4"> <input class="norm" type="text" size="58" name="comment" id="comment" /></div></td> </tr> </table> </fieldset> </div> <br /> <div> <fieldset> <input style="float:center;" type="submit" value="GET FUND" name="button" onclick='return verify();'/> </fieldset> </div> <br /> <div> <fieldset> <legend>IMPORTANT</legend> <center>FIELDS MARKED WITH AN ASTERISK * ARE MANDATORY<br /> </fieldset> </div> <br /> <div> <fieldset> <legend>ORDER SUBMITTED</legend> <table> <tr> <td align="right">DATE</td> <td><input class="norm" type="text" name="date" id="date" value=""/></td> <td align="right">TIME</td> <td><input class="norm" type="text" name="time" id="time" /></td> </tr> </table> </fieldset> </div> </form> </div> ?> <body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/218272-error-message/ Share on other sites More sharing options...
trq Posted November 10, 2010 Share Posted November 10, 2010 This forum has tags for a reason, please use them. ps: you might want to describe your actual problem as well. Quote Link to comment https://forums.phpfreaks.com/topic/218272-error-message/#findComment-1132570 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.