By Charlie Trig on Wednesday, 13 August 2014
Posted in Pre Sales
Replies 9
Likes 0
Views 1.8K
Votes 0
I have a client that is looking to buy a Forum component, I have highly recommended your EasyDiscuss due to the success I have had with your product in the past - is there a way to make a Custom Field created in EasyDiscuss to be a required field when posting a question?
http://demo.stackideas.com/administrator/index.php?option=com_easydiscuss&view=customfields
Hello Charlie,

Regarding your question:
is there a way to make a Custom Field created in EasyDiscuss to be a required field when posting a question?
I am sorry but currently there is no setting in the current system to make the custom field required.

By the way, it looks like your account subscriptions is already expired. Is there any mistake on our end? Would it be possible for you to contact us at https://crm.stackideas.com and provide us with the order reference and your username so that we can fix this up for you?
·
Wednesday, 13 August 2014 10:45
·
0 Likes
·
0 Votes
·
0 Comments
·
Yes, I figured that out, but I wanted to know if I can edit the code to make the custom fields required. I understand this would involve core hacks, it is a pre-sales question as they did not decide on your software yet - it kinda hinges on the ability of hacking it to make the custom fields required.
I have extensive knowledge of PHP, I just wanted to know from your end if it is feasible before buying it.
·
Wednesday, 13 August 2014 11:56
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Charlie,

I believe it is possible but, it is a core hack where you need to customize the code for each fields because there is no setting available to do this in the current system. Since you have extensive knowledge of PHP, you should be able to customize the code. Here I give you simple code and you can try put this code in this file: \components\com_easydiscuss\controllers\posts.php at function _fieldValidate($post) Line 1430.

if(empty($post['inputtext1'])){
$message .= '<li>' . "custom fields". '</li>';
$valid = false;
}

Hope this will help.
Thanks.
·
Wednesday, 13 August 2014 12:48
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mohd,
I tried that code, placed in the function, but no matter what I put in, I get a validation error "custom fields" (that's what's in the message line).
I tried it with NAME instead of ID and thought that fixed it, but it did not.
I changed the code to this:
if(empty($post['customFieldValue_1[]'])){
$message .= '<li>Please enter your Serial Number</li>';
$valid = false;

Still will not work. Can you think of anything else I can try?
·
Tuesday, 19 August 2014 02:46
·
0 Likes
·
0 Votes
·
0 Comments
·
Ok, so it turns out that your programming uses field NAME and not ID. The brackets that are added to the custom field NAMES in the file simplistic/field.customfield.form.php on line 34:
input id="inputtext1" class="" type="text" placeholder="<?php echo $this->escape($textHolder) ?>" name="customFieldValue_<?php echo $item->id ?>[]" value="<?php echo $this->escape(( empty($value)? '' : array_shift($value)) ) ?>" 

The Custom Field Names are inserting brackets after the field name. When I remove these brackets, it saves the data without error, but displays a function[] IMPLODE error where the field data should be.
I need to have the component not add brackets to the field NAME to get validation to work; the brackets are interfering with the validation.
·
Tuesday, 19 August 2014 03:23
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Charlie,

I am sorry for the late reply.
Regarding your previous reply:
I get a validation error "custom fields" (that's what's in the message line).
Is because of the my provided code:

if(empty($post['inputtext1'])){
$message .= '<li>' . "custom fields". '</li>';
$valid = false;
}
Which displaying custom fields. I have put the code inside your site and it is working correctly. Here my screenshot: http://screencast.com/t/ci8zYYZRZg . Can you verify it for me is this issue is resolved?

Hope this will work.
Thanks.
·
Tuesday, 19 August 2014 11:21
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mohd,
The code does not work, even if you put something into Serial Number, it still says "Enter your Serial Number". As I said, your other validation code like 'category_id' and 'title' does not look at the ID (for custom field 1, inputtext1), it looks at the NAME of the field (which is 'customFieldValue_1[]'). If you look at the other validation codes like title, it uses the NAME of the field.

SO I changed your code from 'inputtext1' to the NAME of the field, 'customFieldValue_1[]' but the trouble is that the BRACKETS after the field are interfering with the VALIDATION. Is there a way to eliminate these brackets from the code without it throwing a function implode error??

Please read the entire post, it seems like you are missing a lot of info when you reply.
·
Tuesday, 19 August 2014 20:41
·
0 Likes
·
0 Votes
·
0 Comments
·
I was able to fix it myself, the code to make it Validate custom fields is:
if (empty($_POST["customFieldValue_1"][0]))
{
$message .= '<li>WHATEVER YOU WANT</li>';
$valid = false;
}

Now that you have the code, could you make it an option to make the Custom Fields Required? It would be the final piece to the puzzle, and everything else about your program is awesome.
·
Wednesday, 20 August 2014 03:51
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Charlie,

I am sorry for the late reply.
Thanks for updating us back. Glad to hear your issue have been resolved. I will have a discussion with our developers about this and see how it goes. For now it is advisable to backup the customization before you updating EasyDiscuss to the latest.

Thanks again and have a wonderful day.
·
Wednesday, 20 August 2014 13:20
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post