drhcanada Posted February 26, 2010 Share Posted February 26, 2010 In the "my details area" is it possible to change the <table width="100%" cellspacing="0" cellpadding="0" class="frame"> <tr> <td><table width="100%" border="0" cellpadding="5" cellspacing="0"> {foreach key=num item=customfield from=$customfields} <tr> <td width="150" class="fieldarea">{$customfield.name}</td> <td>{$customfield.input} {$customfield.required}</td> </tr> {/foreach} </table></td> </tr> </table> to something where I can choose the custom fields that are displayed and which ones are non changeable and which ones can be changed. 0 Quote Link to comment Share on other sites More sharing options...
vchosting Posted February 27, 2010 Share Posted February 27, 2010 I would like the ability to prevent certain custom fields from being updated if possible 0 Quote Link to comment Share on other sites More sharing options...
drhcanada Posted February 27, 2010 Author Share Posted February 27, 2010 I simply want to know what code to replace the code noted above with to get certain custom fileds to be listed. I know I would have to do one line per custom field. but this would let me choose to have it editable or simply display. 0 Quote Link to comment Share on other sites More sharing options...
m00 Posted February 27, 2010 Share Posted February 27, 2010 If you don't want to display all custom fields, why don't you just select the Admin Only on the "Custom Client Fields" page for the fields which you don't want to show to your customers? 0 Quote Link to comment Share on other sites More sharing options...
drhcanada Posted March 1, 2010 Author Share Posted March 1, 2010 that would be great but the problem is with the admin only option turned on they cant fill it out on sign up. I want them to fill the fields out, but I want to manualy choose which ones display in their profile and which are read only versus modifiable. instead of the whole $customfield.input database calls, I simply want to know how to call specific custom fields in the database 0 Quote Link to comment Share on other sites More sharing options...
drhcanada Posted March 9, 2010 Author Share Posted March 9, 2010 nobody has an answer to bring only specific custom fields from the database? 0 Quote Link to comment Share on other sites More sharing options...
m00 Posted March 9, 2010 Share Posted March 9, 2010 Th following isn't a beautiful solution, but it does the job. Find the customfield foreach in the clientareadetails.tpl, and replace it with something like this: {foreach key=num item=customfield from=$customfields} {if $customfield.name neq "Fieldname 1" AND $customfield.name neq "Fieldname 2"} <tr> <td width="150" class="fieldarea">{$customfield.name}</td> <td>{$customfield.input} {$customfield.required}</td> </tr> {else}<input type="hidden" name="customfield[{$customfield.id}]" value="{$customfield.value}" />{/if} {/foreach} Just replace the Fieldname 1, Fieldname 2 etc. with the fieldnames of the fields you don't want to show. 0 Quote Link to comment Share on other sites More sharing options...
drhcanada Posted March 9, 2010 Author Share Posted March 9, 2010 that perfect . thanks. no idea how to simply call a specific field would you? and ignore all others? 0 Quote Link to comment Share on other sites More sharing options...
vchosting Posted March 9, 2010 Share Posted March 9, 2010 Will give this ago thanks 0 Quote Link to comment Share on other sites More sharing options...
m00 Posted March 10, 2010 Share Posted March 10, 2010 that perfect . thanks.no idea how to simply call a specific field would you? and ignore all others? You mean to show only to display the fields you give in instead of hiding them? Just rebuild the if-statement a bit: {foreach key=num item=customfield from=$customfields} {if $customfield.name eq "Fieldname 1" OR $customfield.name eq "Fieldname 2"} <tr> <td width="150" class="fieldarea">{$customfield.name}</td> <td>{$customfield.input} {$customfield.required}</td> </tr> {else}<input type="hidden" name="customfield[{$customfield.id}]" value="{$customfield.value}" />{/if} {/foreach} 0 Quote Link to comment Share on other sites More sharing options...
blymp Posted September 23, 2010 Share Posted September 23, 2010 I just got it! You have two options to make custom fields not editable, in your template code where it says: First option: Locate in your code (clientareadetails.tpl): {$customfield.input} and replace for: {$customfield.value} it will only display the value of your custom field and not let it be changed Second option: replace for: {$customfield.input|replace:'>':' readonly>'} it will set your input for not editable The first one will match the "Locked Client Profile Fields" new option. For showing specifics custom fields I just repeated the custom field code using couple if/else to restrict to certain custom fields: {if $customfields} <!-- restrict to specific custom field - start --> <table width="100%" cellspacing="0" cellpadding="0" class="frame"><tr> <h3>YOU CAN ADD A TITLE HERE</h3> <td><table width="100%" border="0" cellpadding="5" cellspacing="0"> {foreach key=num item=customfield from=$customfields} <tr>{if $customfield.name eq "EXACT-NAME-OF-YOUR-CUSTOM-FIELD-1" || $customfield.name eq "EXACT-NAME-OF-YOUR-CUSTOM-FIELD-2" || $customfield.name eq "EXACT-NAME-OF-YOUR-CUSTOM-FIELD-3"} <td width="215" class="fieldarea">{$customfield.name}</td> <td>{$customfield.input} {$customfield.required}</td> {/if}</tr> {/foreach} </table></td> </tr></table> <!-- restrict to specific custom field - end --> <!-- The "EXACT-NAME-OF-YOUR-CUSTOM-FIELD" is case sensitive, if you change in your settings, you must change in the code too. You can repeat this table for each section of your custom fields, and at the end set up the next one: --> <!-- show the rest of customfields, if existent - start --> {if $customfield.name neq "EXACT-NAME-OF-YOUR-CUSTOM-FIELD-1" && $customfield.name neq "EXACT-NAME-OF-YOUR-CUSTOM-FIELD-2" && $customfield.name neq "EXACT-NAME-OF-YOUR-CUSTOM-FIELD-3"} <table width="100%" cellspacing="0" cellpadding="0" class="frame"><tr> <h3>YOU CAN ADD A TITLE HERE - FOR EXTRA CUSTOM FIELDS</h3> <td><table width="100%" border="0" cellpadding="10" cellspacing="0"> {foreach key=num item=customfield from=$customfields} <tr>{if $customfield.name neq "EXACT-NAME-OF-YOUR-CUSTOM-FIELD-1" && $customfield.name neq "EXACT-NAME-OF-YOUR-CUSTOM-FIELD-2" && $customfield.name neq "EXACT-NAME-OF-YOUR-CUSTOM-FIELD-3"} <td width="215" class="fieldarea">{$customfield.name}</td> <td>{$customfield.input} {$customfield.required}</td> {/if}</tr> {/foreach} </table></td> </tr></table> {/if} <!-- show the rest of customfields, if existent - end --> <br /> {/if} <!-- custom fields --> 0 Quote Link to comment Share on other sites More sharing options...
blymp Posted September 29, 2010 Share Posted September 29, 2010 I just figured out that the first option doesn't work when the user submit the form, it clears out those fields. I have no idea why. So just got with the second option. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.