rvp032582
Posts: 47
|
| Posted: 07/06/2008, 5:11 PM |
|
i need to add to a hidden field text box to a form. this field must not have data in it. if there is data in it then the form must not submit. basically this is another way to prevent spam.
i know how to: insert a hidden text box
what i don't know how to do: is create custom code that basically says If text box name has data in it, then do not allow the form to be submitted etc.
does anyone know in asp and php how to go about it? would it be a Before Execute Insert event code?
|
 |
 |
jjrjr1
Posts: 942
|
| Posted: 07/06/2008, 6:02 PM |
|
Hi
I would do this in the on validate event for the form. Check the value of the hidden field and do what ever you want from there based on it's content. You can put up an error message, go to another page, etc...
PS: Have you tried to implement captcha to elimiate spam entries?
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
datadoit
|
| Posted: 07/06/2008, 7:43 PM |
|
http://docs.codecharge.com/studio40/html/Components/RTP...llowed.html?toc
http://docs.codecharge.com/studio40/html/Components/RTP...llowed.html?toc
|
|
|
 |
rvp032582
Posts: 47
|
| Posted: 07/07/2008, 7:30 AM |
|
2.5 hours later and all i got is:
Fatal error: Call to a member function ToSQL() on a non-object in /home/thedowns/public_html/NewPage1_events.php on line 23
after the form is submitted: http://www.thedownstairsgallery.com/NewPage1.php
i inserted this code:
global $items;
if (CCDLookUp("email_address","emails","email_address="
. $items->DataSource->ToSQL($items->email_address->GetValue()),$items->DataSource))
{
$items->InsertAllowed = false;
$items->Errors->addError("Provide another email adress.");
}
on the BeforeInsert event for the form
and changed all the names etc. i changed the word Datasource to the name of the db connection, that didn't work, i changed it to the name of the actual database and that didn't work, so i now i have:
global $Requests;
if (CCDLookUp("ReqName","Requests","ReqName="
. $Requests->thedowns_downstairs->ToSQL($Requests->ReqName->GetValue()),$Requests->thedowns_downstairs))
{
$Requests->InsertAllowed = false;
$Requests->Errors->addError("Provide another email adress.");
}
thedowns_downstairs is the name of the database...when i submit the form, i get that error....
yes i've tried captcha....
|
 |
 |
rvp032582
Posts: 47
|
| Posted: 07/07/2008, 7:39 AM |
|
update: i was able to get captcha to work on this form: http://www.thedownstairsgallery.com/NewPage1.php
based on: http://forums.yessoftware.com/posts.php?post_id=96638
anyone know how to conver this to ASP?
if (CCGetSession("string", "") != "" && strtoupper(CCGetParam("ReqName","")) != strtoupper(CCGetSession("string", "")))
{
$Requests->Errors->addError("ERROR: Your verification code did not match. Try again.");
}
|
 |
 |
jjrjr1
Posts: 942
|
| Posted: 07/07/2008, 7:42 AM |
|
Why don't you do it in the Validate event for the form.
If you did all you would have to do is
if($Container->hiddenfieldname->GetValue()){
Do your error handling such as setting an error
where CCS would promt there was an error.
Or your error code can re-direct to another page
Or Do just about anything you want;
}
If you set an error in the validate event or somrthing no instert will occur.
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
|