Simple password field validation

ozzie 14 Oct, 2010
Hi,
I am simply trying to place a password lock on access to a page.
I have created a form using the form wizard and everythign works great including redirection etc.
However I need to place a validation of a single predetermines value to use as a fixed password for the password field.
Only selected registered and unregistered users will know this password
I am sure the Chrono form engine can accommodate this simple requirment but I am at a loss as to how to do this using the excellent form system you guys have provided.

For example say I have a password field and a submit button and I want the password to be "123456"
How can I ensure validation occurs with out resorting to a data base entry? [ simple validation ]
using the form system provided [terminology issue for me I think]

I guess one could say it is a bit like a HT Access type validation with out the user name

I am using the latest version
GreyHead 14 Oct, 2010
Hi ozzie,

In the Server-side validation box add
<?php
$password = JRequest::getString('password', '', 'post');
if ( !$password || $password != '12345' ) {
  return 'Please enter a valid password';
}
?>


Bob
ozzie 14 Oct, 2010
Works a treat Bob..... thanks!
That server validation box is an awful powerful tool
amparo 18 Sep, 2012
hi,

can you please help me how to set this in server side? i am using joomla 1.6, chronoform is for 1.6 as well. where will i put the code?
GreyHead 18 Sep, 2012
Hi amparo,

The code is slightly different for ChronoForms v4
<?php
$password =& $form->data['password'];
if ( !isset($password) || !$password || $password != '12345' ) {
  $form->validation_errors['password'] = 'Please enter a valid password';
  return false;
}
?>

It goes into a Custom Serverside Validation action in the Normal/Advanced Wizard. There is no equivalent action in the Easy Wizard.

Bob
amparo 19 Sep, 2012
i already got what you said.. Thank you very much Bob..

but i have another problem,

how will i show a message on submit? i tried to put thank u message on the event on load and also tried on submit but it keeps on returning to the enter password form..
GreyHead 19 Sep, 2012
Hi amparo ,

The Thank You Message action usually goes at to near the end of the On Submit action.

Please drag a Debugger action into the On Submit event, then submit the form and post the debug results here.

Bob
amparo 20 Sep, 2012
Please see my attachment.. Nothing appears even when i put the debugger.
GreyHead 20 Sep, 2012
Hi amparo,

The Custom Serverside Validation action needs to go into the On Submit event and needs to have an Event Loop action in the On Fail event.

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