Hi everyone,
I have one input field...
...that has to be filled out. so i need my form to validate this. under "validation" -> "1 - required (not blank)" i put the name of the field "Foto1", but it won't validate it. Any ideas? Does it work with type="file"-fields anyway?
Thank you!!
Uli
I have one input field...
<input id="foto1" name="Foto1" type="file" />
...that has to be filled out. so i need my form to validate this. under "validation" -> "1 - required (not blank)" i put the name of the field "Foto1", but it won't validate it. Any ideas? Does it work with type="file"-fields anyway?
Thank you!!
Uli
Hi Uli,
I think that the Validation code (Andrew Tetlaw's Really Easy Form Validation from here) will handle this validation. I suspect that ChronoForms doesn't add the necessary code in form fields.
You can probably do this manually, it just needs the appropriate class name added: class="required"
Bob<br><br>Post edited by: GreyHead, at: 2008/02/13 12:09
I think that the Validation code (Andrew Tetlaw's Really Easy Form Validation from here) will handle this validation. I suspect that ChronoForms doesn't add the necessary code in form fields.
You can probably do this manually, it just needs the appropriate class name added: class="required"
Bob<br><br>Post edited by: GreyHead, at: 2008/02/13 12:09
hmmm, having to use an external script would be a little disappointing. what i made the form for (and what i got chronoforms for in the first place) was to make sure the user uploads a file... well.
thank you anyway, i'll try out the script you posted!
thank you anyway, i'll try out the script you posted!
Hi Uli,
The script is already installed - this is built into ChronoForms.
Just try adding the class attribute to your input field - like this:
The script is already installed - this is built into ChronoForms.
Just try adding the class attribute to your input field - like this:
<input class="required" id="foto1" name="Foto1" type="file" />
Bob
Hi Bob,
sorry, got you wrong there before.
Anyway, I put class="required" into my input field now... it won't work. It still sends the email. Thing is, I have input fields for text and textarea fields and they get validated fine. It's just the one for uploading the file that causes trouble.
You can check out the form here
See, it tells you when things aren't filled out but you can send a mail without adding a file.
Thanks very much for helping me with this... Actually, I'm still using V2.3.7 ... maybe I should update.
sorry, got you wrong there before.
Anyway, I put class="required" into my input field now... it won't work. It still sends the email. Thing is, I have input fields for text and textarea fields and they get validated fine. It's just the one for uploading the file that causes trouble.
You can check out the form here
See, it tells you when things aren't filled out but you can send a mail without adding a file.
Thanks very much for helping me with this... Actually, I'm still using V2.3.7 ... maybe I should update.
Hi Ulsen,
Thanks for trying that, sorry it doesn't work. Looks as if something deeper in the code is needed. When I have some time I'll take a look.
ChronoForms 2.3.8 has a few bug-fixes but nothing that's going to affect this issue. The main change is the addition of the plug-ins feature to link to other databases.
Bob
PS Tried the form link but it needs registration and I can't find the registration form.<br><br>Post edited by: GreyHead, at: 2008/02/13 18:29
Thanks for trying that, sorry it doesn't work. Looks as if something deeper in the code is needed. When I have some time I'll take a look.
ChronoForms 2.3.8 has a few bug-fixes but nothing that's going to affect this issue. The main change is the addition of the plug-ins feature to link to other databases.
Bob
PS Tried the form link but it needs registration and I can't find the registration form.<br><br>Post edited by: GreyHead, at: 2008/02/13 18:29
Sorry, my bad.
This link will work.
Thanks a lot you're trying to help me out... it'd be quite handy if ChronoForms could do the trick.
So long,
Uli
This link will work.
Thanks a lot you're trying to help me out... it'd be quite handy if ChronoForms could do the trick.
So long,
Uli
Hi Uli,
Sorry, still can't see it, that link goes to the home page and the previous one gives me "Sie sind nicht berechtigt, diesen Bereich zu sehen. Sie müssen sich anmelden."
Bob
Sorry, still can't see it, that link goes to the home page and the previous one gives me "Sie sind nicht berechtigt, diesen Bereich zu sehen. Sie müssen sich anmelden."
Bob
Hi,
I was wondering if there is any solution to this problem yet... anybody with an idea how to validate that a file gets uploaded?
Right now my client has to either ignore emails without attachments or give an answer saying, "we're sorry, can you send your data again but this time with files attached?" :dry:
Thanks in advance for whatever anyone might reply to this...😉
Uli
I was wondering if there is any solution to this problem yet... anybody with an idea how to validate that a file gets uploaded?
Right now my client has to either ignore emails without attachments or give an answer saying, "we're sorry, can you send your data again but this time with files attached?" :dry:
Thanks in advance for whatever anyone might reply to this...😉
Uli
Hi Uli,
I think you'd have to hack the code in chronocontact.php a little to add a check after the uploaded files are handled. You could use the same code as imagevalidation does to re-show the form.
Bob
I think you'd have to hack the code in chronocontact.php a little to add a check after the uploaded files are handled. You could use the same code as imagevalidation does to re-show the form.
Bob
i have the same problem. With ChronoForms i'm not able to set required upload.
Please, could you help me to hack chronocontact.php?
What code i have to add and where... thanks!
Please, could you help me to hack chronocontact.php?
What code i have to add and where... thanks!
Hi Attila16881,
In ChronoForms v3.0 you could use server side validation to check that there is an entry in the $attachments array.
Bob
In ChronoForms v3.0 you could use server side validation to check that there is an entry in the $attachments array.
Bob
How could i use server side validation? Do i need just to set "yes" on "server side validation" and then insert the php code or i need something else on my webserver?
And this code to check if a file is uploaded is correct (file_2 is the name of the uploaded file)?
thanks!
And this code to check if a file is uploaded is correct (file_2 is the name of the uploaded file)?
<?php
if (!is_uploaded_file($_FILES['file_2']) AND
!isset($error)) {
$error = "<b>You have to upload a file!</b><br /><br />";
unlink($_FILES['file_2']);
}
?>
thanks!
Hi Attilla16881,
I don't know for sure but something like that looks good to me.
Yes you just turn on and add the code. There's an example on the tab. I think you may need to return something???
Bob
I don't know for sure but something like that looks good to me.
Yes you just turn on and add the code. There's an example on the tab. I think you may need to return something???
Bob
i have tried to use different functions to check if the file is uploaded:
ISEMPTY
ISSET
all without any result... Someone could help me to setup a good file validation?
ISEMPTY
ISSET
all without any result... Someone could help me to setup a good file validation?
how can i use it if the filename is different every time?
I cannot change the filename of the uploaded file from users...
I cannot change the filename of the uploaded file from users...
Hi Attilla16881,
Let's start over - please tell me what your question is as I've lost track.
ChronoForms checks the uploaded files, adds a bit to the file name to avoid over-writing existing files and puts them in the UpLoads folder. What is it that you need to do that is different?
Bob
Let's start over - please tell me what your question is as I've lost track.
ChronoForms checks the uploaded files, adds a bit to the file name to avoid over-writing existing files and puts them in the UpLoads folder. What is it that you need to do that is different?
Bob
i need that users must upload an image file (it needs to be a required field). I cannot handle with "required" option in html (it doesnt work) and i dont know how to do it in php (i have tried everything i said on these posts)
Hi Attila16881,
you will nee server side validation for this, something like :
this doesn't work ? do you get the file uploads fine when you try to choose one ?
Max
you will nee server side validation for this, something like :
<?php
if(!is_uploaded_file($_FILES['file_2'])) return "you must upload some file";
?>
this doesn't work ? do you get the file uploads fine when you try to choose one ?
Max
this solution doesnt work. When i dont upload file it gives me an error, when i upload a file it gives me the same error -.-
OK, try this instead:
<?php
if(!is_file($_FILES['file_2']['tmp_name'])) return "you must upload some file";
?>
This topic is locked and no more replies can be posted.