solved How do I add banned item code to a custom form?

researchcooperative
@researchcooperative
7 years ago
694 posts
The documentation offers this code snippet for adding to custom forms, to screen unwanted words. How exactly should this be added? I am hoping to be able to use this to reduce the frequency of spam contact messages.

****

// Action Text
$_tmp = array(
'name' => 'action_text',
'label' => "Activity",
'help' => "Update your activity post",
'type' => 'textarea',
'ban_check' => 'word',
'validate' => 'printable',
'required' => true
);
jrCore_form_field_create($_tmp);




--
PJ Matthews, Kyoto
Migrated from Ning 2.0. Now at Jamroom 6 beta and using Jamroom Hosting for The Research Cooperative (researchcooperative.org)

updated by @researchcooperative: 06/25/17 10:52:33AM
michael
@michael
7 years ago
7,715 posts
Which documentation?

That code is code to create a form while creating a module. Most modules have forms, audio, video, action, blog, they all contain forms and they are all constructed using code similar to that you've posted there.

Suspect you're not building a form in a module via code.

If you're having trouble with spam, perhaps limit the form submission to only logged in users.
researchcooperative
@researchcooperative
7 years ago
694 posts
The Banned Item documentation, which further states:

You can use the jrBanned modules features when creating forms by adding in a 'ban_check' => 'word', to the form field creator of your module.


"the form field creator of your module" - does this apply to custom forms?


--
PJ Matthews, Kyoto
Migrated from Ning 2.0. Now at Jamroom 6 beta and using Jamroom Hosting for The Research Cooperative (researchcooperative.org)
michael
@michael
7 years ago
7,715 posts
By "Custom Form" you're meaning the Simple Custom Forms module?

Marketplace: "Simple Custom Forms"
https://www.jamroom.net/the-jamroom-network/networkmarket/88/simple-custom-forms

If so, then no. The instructions are not for using the Form Designer. The instructions are for module developers creating forms for their modules.
researchcooperative
@researchcooperative
7 years ago
694 posts
That's right, so yes, no!

I will think about the login setting.

It is certainly an easy option (though it prevents easy legitimate contact from non-members).

Thanks for the tip.

Peter


--
PJ Matthews, Kyoto
Migrated from Ning 2.0. Now at Jamroom 6 beta and using Jamroom Hosting for The Research Cooperative (researchcooperative.org)
michael
@michael
7 years ago
7,715 posts
For the public facing one, put up an image of your email address, that way the bots wont be able to read it like text and spam you, but human readers will still have a way to contact you.