Forums

validation of text box and simple counter

dandy84 13 Apr, 2009
Hi all!
i have two requests :

1- i want to have a validation of text box depending on the lenght of it. For example a password of a minimum of 6 characters...how can i do?

2- I want to create a simple counter to count a number of subscribers. I want to use this counter for my email.

thank you for you help!
GreyHead 13 Apr, 2009
Hi Dandy84,

Using the latest RC4.11 version you can add this snippet into your Form HTML box (replace text_0 - in three places - with the id of the field you want to validate:
<?php
$script = "
window.addEvent('domready', function() {
  var text_0 = new LiveValidation('text_0');
  text_0.add( Validate.Length, { minimum: 6 } );
});
";
$doc =& JFactory::getDocument();
$doc->addScriptDeclaration($script);
?>

I don't understand the counter - what do you want to count and when?

Bob
dandy84 14 Apr, 2009
thank u! for counter i mean this:
i have a form for user registration once i have a new user, arrive to my email a message with all the details of new user i want in this email have also a counter for how many user i have....sorry for my english...i hope now i have explain better...
GreyHead 14 Apr, 2009
Hi Dandy84,

Add a hidden field to your form, then in the OnSubmit Beofre box add a database lookup to count the subscribers and set the result to be the value of the form field.

Bob
yourgeek 09 Jul, 2011
Hi
can you please tell me how to change the default message (Must not be less than 6 characters long!) for the password validation? I want to change it and translate it to Greek.

Thank you
GreyHead 09 Jul, 2011
Hi yourgeek,

Which version of ChronoForms are you using? You can find the version from Site Admin | Extensions | Install/Uninstall | Components in Joomla! 1.5 or Site Admin | Extensions | Extension Manager | Manage in Joomla! 1.6.

Bob
yourgeek 09 Jul, 2011
Hi
the version is 3.2

Thanks
GreyHead 12 Jul, 2011
Hi yourgeek,

The simplest way is to edit the Form HTML and set the title attribute in the input to title='Some message' This will over-ride the default validation message.

Bob
This topic is locked and no more replies can be posted.