Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Editing multiple emails

New Here ,
Aug 08, 2008 Aug 08, 2008
Help ! I need to validate multiple (line item) email addresess.

I found the following java email validation and it works great for validating one email entry :

<script language="JavaScript1.2">

var testresults
function checkemail(){
var str=document.norsAddSupplierForm.contactEmail.value
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
testresults=true
else{
alert("Please enter a valid E-Mail address.")
testresults=false
}
return (testresults)
}
</script>

<script>
function checkbae(){
if (document.layers||document.getElementById||document.all)
return checkemail()
else
return true
}
</script>

When I bring up my form in edit mode, I display all the values for a particluar key. For example, my query might return five line items that can be edited. I add a checkbox next to each record. Here is my code :

<td align="center" width="40"><cfinput type="checkbox" name="edit" value="#supplierID#"></td>
<td align="center" width="360">
<cfinput type="text" name="contactName_#supplierID#" size="50" maxlength="50" value="#contactName#">
</td>
<td align="center" width="360">
<cfinput type="text" name="contactEmail_#supplierID#" size="50" maxlength="50" value="#contactEmail#">
</td>

Here is my problem. How do I modify the java code to validate the emails that have been checked for editing ? Each email name is contactemail_#supplierID# and I do not know how to incorporate that into the javascript to validate each email ?

Can somebody please help ? Thanks
234
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 09, 2008 Aug 09, 2008
LATEST
The easiest way is to use <cfinput validate="email">
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources