SSV Problem in V4

jwill 11 May, 2012
Bob,

Migrating to V4 is like having my teeth all pulled. I hope you can expedite you V4 book. I am trying to do validation edits (required fields.) Since Java Script edits didn't work, I assumed I must have the JQerry problem and to Server Side Validation.

I have two contact forms. On one I moved the Auto SSV to the top of OnSubmit and added an Event Loop in the OnFail (with the defaults.) I added the fields (comma delimited and used the default error message.) Nothing happens, the blank form is submitted.

On the other form I moved Custom SSV to the top of OnSubmit and added an Event Loop in the On Fail (with the defaults.) I changed the string in the PHP to false and added the error message. It no longer submits the form, but it doesn't display any error message. Here is the PHP:
<?php
$field = JRequest::getVar('name', '', 'post');
if ( !$field )  {
$form->validation_errros['name'] = "Name is a required field.";
  return false;
}
?>

<?php
$field = JRequest::getVar('email', '', 'post');
if ( !$field )  {
$form->validation_errros['email'] = "Email is a required field.";
  return false;
}

?>
<?php
$field = JRequest::getVar('message', '', 'post');
if ( !$field )  {
$form->validation_errros['message'] = "Message is a required field.";
  return false;
}
?>

After the SSV events I have a EMail(GH) and Show Thank You.

Hopefully you can give me some direction on what I'm overlooking.

Jim
jwill 11 May, 2012
Bob,

A followup to my previous message. If I add a debug action, the error messages show up in the Auto SSV form:

SSV Problem in V4 image 1

When the debug action is removed, the form is submitted with no error messages.

The error messages do not show up in the custom SSV form even with the debug action:

SSV Problem in V4 image 2

Thanks for any assistance you can give me.

Jim
Max_admin 11 May, 2012
Hi Jim,

How did you setup the form actions in the on submit event ? please show me a screenshot.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
jwill 11 May, 2012
Bob,

Here is the custom SSV form (the php code was in my previous message):

SSV Problem in V4 image 3
SSV Problem in V4 image 4

Here is the auto SSV form:

SSV Problem in V4 image 5
SSV Problem in V4 image 6
SSV Problem in V4 image 7

Thanks,

Jim
jwill 11 May, 2012
Bob,

The Debug event is still in my Custom screen shot. I also tried it in the On Submit. The form didn't work with or without the debug.

Jim
jwill 17 May, 2012
Bob,

Did you have a chance to look at the screen shots I posted?

Jim
GreyHead 18 May, 2012
Hi Jim,

Sorry, I skipped past this thread once Max replied.

First the Custom Serverside validation from your first post. Please change the code to:
    <?php
$isvalid = true;
if ( !isset($form->data['name']) || !$form->data['name'] ) {
  $form->validation_errors['name'] = "Name is a required field.";
  $isvalid = false;
}
if ( !isset($form->data['email']) || !$form->data['email'] ) {
  $form->validation_errors['email'] = "Email is a required field.";
  $isvalid = false;
}
if ( !isset($form->data['message']) || !$form->data['message'] ) {
  $form->validation_errors['message'] = "Message is a required field.";
  $isvalid = false;
}
return $isvalid;
?>
Note that it is $form->validation_errors - the Help text has a typo.

The Auto Serverside validation is more mysterious, all the settings look correct but the Debugger data array is empty. Please take a Form Backup using the icon in the Forms Manager and post it here (as a zipped file) or PM or email it to me and I'll take a closer look.

Bob
jwill 18 May, 2012
Bob,

The typo fixed the custom validation--thank you.

I have attached a backup of the auto validation.

Thanks for you help.

Jim
jwill 18 May, 2012
I just discovered that if place the fields in "Not Empty", validation works with auto SSV. If I put the field names in "Required", there is no validation with auto SSV. "Not Empty" accepts a space as valid. What is the definition of each of these selections?

Jim
GreyHead 19 May, 2012
Hi Jim,

Max has used some slightly different meanings for the Auto ServerSide validation:

Required: Comma delimited list of required fields names, these fields should exist in the data array in order to pass this check.

This just tests if the input is in the $form->data array - not if it has valid content. This test will only be failed by un-checked checkboxes or radio buttons. Inputs, textareas and select drop-downs will always exist in the $form->data array.

Empty/Not Empty

This will test if the value in the $form->data array is literally empty i.e. there is no character in it. Any character - even a space - will count as 'not empty'.

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