Page 1 of 1

Display only certain custom fields?

Posted: Fri May 04, 2012 2:56 am
by SS113
Hello,

Is there any way for me to display only part of the custom fields?

For example:

I have custom fields:
A, B, C, D

Right now as I see it no matter what, all of them will display from A to D on a form. What if i want to only display A and B based on the form they are on? Then C and D will display on a different form?

When I say form I mean one form will be for customers to fill out and the other will be from the admin panel just like we have ticket.php in root folder and then we have new_ticket.php in admin folder.

Thank for any help!

Re: Display only certain custom fields?

Posted: Fri May 04, 2012 5:43 am
by Klemen
You would have to manually modify the forms to achieve that. Don't forget to backup first.

For example in index.php find

Code: Select all

$v['use']
(twice) and change it to something like

Code: Select all

$v['use'] && ! in_array($v['name'], array('Custom field 1','Custom filed 3') )
This should not print out fields named "Custom field 1" and "Custom field 2". Names must exactly match names of your custom fields.

Or if you prefer to use custom field numbers (maybe better - this way if you change name it still won't show 1st and 3rd custom field):

Code: Select all

$v['use'] && ! in_array($k, array('custom1','custom3') )
Also make sure these fields aren't required or the customer would be getting a "required fields missing" error.

Re: Display only certain custom fields?

Posted: Fri May 04, 2012 5:01 pm
by SS113
Great Klemen! Thank you very much for the quick reply!

I'll let you know if I bump into any problems but sounds pretty straight forward!

Thanks