Hello,
I'm making a joomla page and for the first time i'm using Chronoforms.
Now, for validation of the form i like to use my custom-validation i always use on all my PHP form
But with no luck.
It seems that Chronoforms don't recognize
Can anybody confirm this?
In my form the submit button code is :
So normally on clicking it,it should execute the code.
The code to execute, i've tried to put it at several places with no luck:
1/header include
2/formcode of the Chronoform form manager
3/Validation form manager -> Server Side validation Code
I also allready tried to simplify the code to a test-code, to skip any coding errors:
but even that doesn't work.
If i put
So, Chronoforms does execute php without any problem.
Any ideas?
Thanks.
I'm making a joomla page and for the first time i'm using Chronoforms.
Now, for validation of the form i like to use my custom-validation i always use on all my PHP form
But with no luck.
It seems that Chronoforms don't recognize
if(isset($_POST['submit']))
?Can anybody confirm this?
In my form the submit button code is :
<button class="submitbutton" type="submit" name="submit">Submit</button>
So normally on clicking it,it should execute the code.
The code to execute, i've tried to put it at several places with no luck:
1/header include
2/formcode of the Chronoform form manager
3/Validation form manager -> Server Side validation Code
I also allready tried to simplify the code to a test-code, to skip any coding errors:
if(isset($_POST['submit'])){echo"ok";}
but even that doesn't work.
If i put
if(!isset($_POST['submit'])){echo"ok";}
-> then it displays "ok" on the page before the submit button is clicked, like it should.So, Chronoforms does execute php without any problem.
Any ideas?
Thanks.
Hi marko123,
ChronoForms will recognise any valid PHP including your snippet.
If you are trying to validate with PHP, then you probably need to use the server-side validation box. But note that there is a specific syntax to use there - see the Example Code on the tab.
Bob
ChronoForms will recognise any valid PHP including your snippet.
If you are trying to validate with PHP, then you probably need to use the server-side validation box. But note that there is a specific syntax to use there - see the Example Code on the tab.
Bob
thank you for the effort to reply so quickly.
As stated in my first post i allready tried to put PHP code in the server side validation code. but with no luck.
Very simple snippets like:
<?php
return"ok";
?>
does work
but if and if..else statements are not executed, allthough i have exactly followed the example code.
My example:
In fromcode we have an inputbox "name":
<input class="cf_inputbox required" maxlength="150" size="30" title="please fill in field" id="name" name="name" type="text" />
In server side validation code, following the example snippet:
<?php
if($_POST['name']=='marko')
return 'name is filled in';
?>
tried with or without the brackets {}arround the return statement
no message is displayed after putting 'marko' in the name field and clicking the send button.
(allthough a simple comment like:
return $_POST['name'];
does work, so the $_POST is being recognized.
so, validation code
<?php
if($_POST['name']=="")
{some code;}
else
{some code;}
?>
doesn't work either
I'm a little bit stuck, trying 2 days to get chronoforms working with external PHP code...
so if any suggestion, please let me know.
I'll be very gratefull :-)
As stated in my first post i allready tried to put PHP code in the server side validation code. but with no luck.
Very simple snippets like:
<?php
return"ok";
?>
does work
but if and if..else statements are not executed, allthough i have exactly followed the example code.
My example:
In fromcode we have an inputbox "name":
<input class="cf_inputbox required" maxlength="150" size="30" title="please fill in field" id="name" name="name" type="text" />
In server side validation code, following the example snippet:
<?php
if($_POST['name']=='marko')
return 'name is filled in';
?>
tried with or without the brackets {}arround the return statement
no message is displayed after putting 'marko' in the name field and clicking the send button.
(allthough a simple comment like:
return $_POST['name'];
does work, so the $_POST is being recognized.
so, validation code
<?php
if($_POST['name']=="")
{some code;}
else
{some code;}
?>
doesn't work either
I'm a little bit stuck, trying 2 days to get chronoforms working with external PHP code...
so if any suggestion, please let me know.
I'll be very gratefull :-)
Hi Bob,
first of all:
i do appreciate your quick support and thank you for this.
However at my end, i can't get the "more soficticated" external PHP coding working with Chronoforms, I'm not sure either what can be the problem, as said: easy "echo" statements are accepted and turns out correctly.
So I decided to put Chronoforms aside and I downloaded an "addPHP" plugin which let me write/execute PHP in joomla articles.
With this solution i got it working ( offcourse starting from scratch, form and server validation)
So, my goal is achieved.
I still which to thank you for your time and willingness to think along, and if I get the time to investigate more, I surely will let the forum know what the problem was i encountered.
first of all:
i do appreciate your quick support and thank you for this.
However at my end, i can't get the "more soficticated" external PHP coding working with Chronoforms, I'm not sure either what can be the problem, as said: easy "echo" statements are accepted and turns out correctly.
So I decided to put Chronoforms aside and I downloaded an "addPHP" plugin which let me write/execute PHP in joomla articles.
With this solution i got it working ( offcourse starting from scratch, form and server validation)
So, my goal is achieved.
I still which to thank you for your time and willingness to think along, and if I get the time to investigate more, I surely will let the forum know what the problem was i encountered.
Below I use the example of a radio button and then an input text field.
Notice the difference: I worked with this for about 3 hrs JUST to figure out that for some reason the input text field was getting submitted as a blank (not NULL)... EVEN though when I turned DEBUG ON, the field name ("prfname" -- below) was not shown in my submitted list of fields in the DEBUGGER text.
I also trimmed off beginning spaces... so users did not enter spaces.
Notice the difference: I worked with this for about 3 hrs JUST to figure out that for some reason the input text field was getting submitted as a blank (not NULL)... EVEN though when I turned DEBUG ON, the field name ("prfname" -- below) was not shown in my submitted list of fields in the DEBUGGER text.
I also trimmed off beginning spaces... so users did not enter spaces.
<?php
$messages = '';
$brk = '<br />';
if(!isset($_POST['pcstatus'])) {
$messages .= "Presenter's Membership NOT SET";
}
$prfname = ltrim($_POST['prfname']);
if(!isset($prfname)) {
$messages .= $brk . 'Please enter presenter's first name (NOT SET)';
} else if (($prfname)=='') {
$messages .= $brk. 'Please enter presenter's first name (BLANK)';
}
if ($messages != '') return $messages;
?>
Hi cubefree,
I'd probably use slightly different syntax here -- example below.
I still don't see why a text input would not have a value in the $_POST array though. I just ran a test and it was included OK :-(
This example uses the Joomla! JRequest methods to validate the input type and set default values (so the isset test is no longer required); and it collates the messages in an array rather than a string.
Bob
I'd probably use slightly different syntax here -- example below.
I still don't see why a text input would not have a value in the $_POST array though. I just ran a test and it was included OK :-(
This example uses the Joomla! JRequest methods to validate the input type and set default values (so the isset test is no longer required); and it collates the messages in an array rather than a string.
<?php
$messages = array();
$pcstatus = JRequest::getString('pcstatus', '', 'post');
if( !$pcstatus' ) {
$messages[] = "Presenter's Membership NOT SET";
}
$prfname = JRequest::getString('prfname', '', 'post');
$prfname = trim($prfname);
if( !$prfname ) {
$messages[] = "Please enter presenter's first name";
}
if ( count ($messages)) {
return implode('<br />', $messages);
}
?>
Bob
This topic is locked and no more replies can be posted.