Make fields as required

joshkovel 10 Aug, 2007
I had a contact form and want to make all the fields as required. I embedded PHP code in 'Form Code' in 'Form HTML', but it is not working.

Could any one help me with this.

Thank you

Code is:
Enter name (First Name + Last Name):<br />
<input name="Name" type="text" class="style1" style="width: 252px" /><br />
<?php
$Name = $_POST['Name'];
if ($Name==" ")
echo "Please enter your name";
?>


Enter the Institution/Company:<br />
<input name="Company" type="text" class="style1" style="width: 252px" /><br />
<?php
$Company=$_POST['Company'];
if ($Company==" ")
echo "Please enter your Company";
?>

Enter Occupation:<br />
<select name="Occupation" style="width: 203px">
<option selected="selected">Select the option</option>
<option>Scientist</option>
<option>Industry</option>
<option>Farmer/Rancher</option>
<option>Veterinarian</option>
<option>Educator</option>
<option>Other</option>
</select>
If Other:<input name="Other" type="text" style="width: 258px" /><br />



Enter Area of Interest:<br />
<select name="Area" style="width: 202px">
<option selected="selected">Select the option</option>
<option>Epidemiology and Transmission</option>
<option>Diagnostics and Strain Differentiation</option>
<option>Map Biology and Pathogenesis</option>
<option>Map Immunology and Vaccine Development</option>
<option>Genomics, Antibodies, and Proteomics</option>
<option>Animal Models and Facilities</option>
<option>Extension and Outreach</option>
</select><br />

Enter email:                                              
<br />
<input name="Email" type="text" style="width: 258px" /><br />
Enter your preferred USER ID:<br />
<input name="userid" type="text" style="width: 258px" /><br />
Enter Message:<br />
<textarea name="Message" style="width: 260px; height: 149px"></textarea><br />
Upload Resume:<br />
<input name="Resume" type="file" /><br />
<br />
<input type="submit" value="submit" /><br />
Max_admin 10 Aug, 2007
Hi Josh,

This wont work as you are using PHP, its hard to achieve this in PHP and the PHP code should be on the submit event, a better way is to use javascript, you can search the forum for some examples or wait the new release as its planned to add a new feature to make this easy.

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 10 Aug, 2007
Hi joshkovel,

As Max says this is not the easiest way to do this. PHP code is executed on the server and so the page has to be submitted before there is anything in $_POST for it to look at. Having users click submit after each field would be unfriendly.

You can do this much more simply in JavaScript and I'd suggest one of the many ready-made validations scripts. A couple have been posted here recently, when I have a moment I'll put some references in the FAQs.

Bob
joshkovel 11 Aug, 2007
I'm not a javascript expert. Could anyone give me the javascript code of what to add for making all the fields as required.

Thank you
Max_admin 11 Aug, 2007
Hi Josh,

Sorry for the delay, it's a busy a weekend😉

If you make a quick search in the forums here you will find many posts with examples of how to make any field 'as required', this will you give you better control over it, and you don't have to be expert at all!!

A very cool topic is this one:
Realy easy validation, it will show you how to get a cool easy validation working🙂

Cheers

Max

PS from Greyhead. I've written a 'Really Easy Field Validation' tutorial here. It's made a slightly simpler version of Bouton's post with a little demo form so that you can see the result.

Post edited by: GreyHead, at: 2007/08/11 21:15<br><br>Post edited by: GreyHead, at: 2007/08/13 00:42
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Max_admin 13 Aug, 2007
Hi Josh,

ChronoForms v2.3 is out with new validation tab to make this very easy for everybody, please check it out.

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
joshkovel 14 Aug, 2007
Do you mean chronoform V2.3RC1. Right now, I'm using V2.2.1. Is there any patch to update to V2.3RC1. The main thing is I want to make all fields as required.

Any help please.

Thank you
Max_admin 14 Aug, 2007
Yes, a post has been made earlier today how to upgrade and I replied there with steps, after upgrade all should be fine and you can make any fields you like as required🙂

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
joshkovel 15 Aug, 2007
I'm trying to upgrade from V2.2.1 to V2.3RC1 using these steps:

1# extract the v2.3 package.
2#Login to your site through FTP.
3#backup your current com_chronocontact folder under components and administrator/components/
4# overwrite files under components/com_chronocontact/ with similar file names in the package of v2.3 and also add folder called js
5# do the same with administrator/components/com_chronocontact/ you should replace existing files and then add a directory called excelwriter

But when overwriting the files I'm facing an issue. I'm not able to do it.

Error is:
Permission denied.
Error code: 3
Error message from server: Permission denied
Request code: 3




I would appreciate if anyone could help me with this.

Thank you
Max_admin 15 Aug, 2007
Hi Josh,

Ok, this will need you to CHMOd this directory and files, anyway lets try this first :

at this post : chronoforms v2.3

Bob has posted the 2 folders of chornoforms attached at the bottom, please download them and rename your similar folder names on server then upload those!!

Cheers

max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
joshkovel 15 Aug, 2007
I have done it but overwriting didn't work.

Any help?<br><br>Post edited by: joshkovel, at: 2007/08/14 23:40
Max_admin 15 Aug, 2007
sorry, plz try to rename the original folders then upload those, this should not break the permissions.
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
joshkovel 15 Aug, 2007
I have renamed but didn't work. Same error.

Any help please?
Max_admin 15 Aug, 2007
Try to chmod all path to this dir to 0777 and then try again, if it didnt work then please try to do this at your hosting cPanel file manager if you have one or ask your host to chmod the folder for you!!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
joshkovel 15 Aug, 2007

Try to chmod all path to this dir to 0777 and then try again, if it didnt work then please try to do this at your hosting cPanel file manager if you have one or ask your host to chmod the folder for you!!



I changed the permissions in the cpanel to 0777 but overwriting didn't work.

Any help please?

Thank you
Max_admin 15 Aug, 2007
Hi,

do this for the components dir then try renaming components/com_chronocontact to com_chronocontact2 , does this work ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
joshkovel 18 Aug, 2007

Hi,

do this for the components dir then try renaming components/com_chronocontact to com_chronocontact2 , does this work ?



I copied all the files using different folder i.e. com_chronocontact2 in components folder and in administrator folder.

But while trying to delete the original folder, It says cannot delete it,

After making new folders, how to make changes effective in the back end i.e. in administrator page. How do I get the validation tab.

Could anyone help me with this.
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger