Forums

unique validation warning message

alexo101 15 Sep, 2010
Hi, my name is Alex I use Chronoforms in many sites and I think it is the best joomla form component.Thanks for the excellent work!!

I have this little problem:
I have a very long form with a lot of fileds (of any kind: radio buttons, checkboxes, text areas, textfileds...) , most of those fileds are required and I can easily manage them with the validation filed tab BUT is there a way to have a unique warning message near the submit button that simply says that one of the required fileds has been left empty?

Without this function the visitor that fills the form leaving one required field emplty, press the submit button, nothing happens, he does not think about scrolling back up the page to see if any error message has appeared and just thinks the forms doesn't work so he just leave the website.

I already searched this forum for a solution I found something (here is part of the code that Bob created for a similar problem
<?php
$script = "
window.addEvent('domready', function() {

var check_file = function() {
  if ( !$('file_2').value ) {
    $('CF_LV_ERROR_file_2').setStyle('display', 'block');
  } else {)...............

this solution is not working for me and it is not really useful in my case since I have 60/70 required fields and this solution would create a warining message for every missing required field nd I would like a single warning message.

Is there anyway to do this?

Thanks a lot for any help

ps: I hope my english is not very bad:)
GreyHead 15 Sep, 2010
Hi Alex,

There's a script in this post that could be adaped to display a div near the submit button (at present it pops up a JavaScript alert).

Bob
alexo101 15 Sep, 2010
Hi Bob thanks, I tried the script it's perfect (a popup window is as good as an alert div) but as you said on that thread the function works at the second click on the submit button.Is there a way to make it trigger at the first click?
I saw you suggested some solutions:
* Break the form into smaller chunks
* Use a pop-up and fix the code so that it doesn't need two clicks.
* Group the error messages at the end of the form.
* Add a script to show a warning message near the Submit button.
* Use a script to disable he submit button until the form is validated.
* Add a script to switch focus back to the first invalid field.

but i really would not know how to put them at work. can you help?
Thanks agian
This topic is locked and no more replies can be posted.