Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: Defining a function in a message template

Posts: 1
Registered: 3/16/2005
Member Is Offline
posted on 3/16/2005 at 05:24 PM Reply With Quote
Defining a function in a message template

I have defined a function in the message template to return a different error message than the default. I have this working but now I want to return a different error message depending upon which form field has an error. I need to know which form field is being checked so that I can return the proper error message.

Below is my code.

function validatemessage(theform)
if (document.forms[theform].price.value<2)
return '"%l%" cannot be less than 2.'
return '"%v%" is not valid value for "%l%"';

v1_config =
'alert' : 1,
'alert_class' : ['fieldtitlenotvalid', 'fieldtitle'],
'messages' :
'fill' : [
function (theform){return validatemessage(theform);}

I want to return the less than 2 error message only for the price field and I want to return the other message for all other fields. If price is less than 2, this code returns the less than 2 error for all fields.

How do I determine which field is calling my function?
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Product Page
Product Demonstrations Product Demos
Registration Form Validation
Login Form Validation
Multiple Forms Validation
Product Documentation Documentation
Documenation Page
Change Log
Validators Comparison Table
Support Forum Technical Support
Support Forum
Customer Care System
Order Now ORDER NOW!
Add to Cart
View Cart

Go To Top

Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004