PHP Error for certain fields
Posted: 19 August 2010 02:52 AM   [ Ignore ]
Has a Great Personality
Avatar
Rank
Total Posts:  47
Joined  2010-03-27

I’ve been getting this error only on fields that I’m using Brandon Kelly’s custom field pack. Like PT Dropdown or PT Pill:

A PHP Error was encountered
Severity
Notice

Message
: Use of undefined constant safecracker_0 assumed 'safecracker_0'

Filenamelibraries/Functions.php(640) : eval()'d code

Line Number: 38 

Links to his custom field types.
http://pixelandtonic.com/divebar

Help?

Profile
 
 
Posted: 19 August 2010 03:02 AM   [ Ignore ]   [ # 1 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

Can we see your template code?

Profile
 
 
Posted: 19 August 2010 03:05 AM   [ Ignore ]   [ # 2 ]
Has a Great Personality
Avatar
Rank
Total Posts:  47
Joined  2010-03-27

More or less a copy-paste of your example. I didn’t alter anything to specifically call it out like if pt_pill or anything.

<div id="main">
<
h2>Report an Issue</h2>

{exp:safecracker channel="support_tracker" return="safecracker/ENTRY_ID" entry_id="{segment_3}"}
    
<p><label for="title">Title</label>
    <
input type="text" name="title" id="title" value="{title}" size="50" maxlength="100"></p>

    <
p><label for="url_title">URL Title</label>
    <
input type="text" name="url_title" id="url_title" value="{url_title}" maxlength="75" size="50" /></p>

    
{custom_fields}
        
<p><label for="{field_name}">{if required}{/if}{field_label}</label>
        
        
{field_instructions}
        
        {formatting_buttons}
        
        {if textarea}
            
<textarea id="{field_name}" name="{field_name}" dir="{text_direction}" rows="{rows}">{field_data}</textarea></p>
        
{/if}
        
        {if text}
            
<input type="text" dir="{text_direction}" id="{field_name}" name="{field_name}" value="{field_data}" maxlength="{maxlength}" size="50" /></p>
        
{/if}
        
        {if select}
            
<select id="{field_name}" name="{field_name}">
            
{options}<option value="{option_value}"{selected}>{option_name}</option>{/options}
            
</select></p>
        
{/if}
        
        {if date}
            
<input type="text" id="{field_name}" name="{field_name}" value="{field_data}" size="50" /></p>
        
{/if}
        
        {if checkbox}
            {options}
<label class="checkbox">{option_value} <input type="checkbox" id="{field_name}" name="{field_name}[]" value="{option_value}"{checked} /></label>{/options}</p>
        
{/if}
        
        {if radio}
            {options}
<label class="checkbox">{option_value}<label class="checkbox"> <input type="radio" id="{field_name}" name="{field_name}" value="{option_value}"{checked} /></label>{/options}</p>
        
{/if}
        
        {if file}
            {display_field}
</p>
        
{/if}
        
        {if safecracker_file}
            {display_field}
</p>
        
{/if}
        
        {if relationship}
            
<select id="{field_name}" name="{field_name}">
            
{options}<option value="{option_value}"{selected}>{option_name}</option>{/options}
            
</select></p>
        
{/if}
        
        {if multiselect}
            
<select id="{field_name}" name="{field_name}[]" multiple="multiple">
            
{options}<option value="{option_value}"{selected}>{option_name}</option>{/options}
            
</select></p>
        
{/if}
    
    {
/custom_fields}
    
    {status_menu}
        
<p><label for="status">Status</label>
        <
select name="status" id="status">
        
{select_options}
        
</select></p>
    
{/status_menu}

    
<p><label for="entry_date">Date</label>
    <
input type="text" name="entry_date" id="entry_date" value="{entry_date}" maxlength="23" size="25" /></p>

    
{category_menu}
        
<p><label for="categories">Categories</label>
        <
select name="category[]" id="categories" size="4" multiple="multiple">
        
{select_options}
        
</select></p>
    
{/category_menu}
    
    {if captcha}
        
<p><label for="captcha">Please enter the word you see in the image below:</label
        {captcha}
        
<input type="text" name="captcha" value="{captcha_word}" maxlength="20" /></p>
    
{/if}

    
<p><input type="submit" name="submit" value="Submit" /></p>

{/exp:safecracker}
</div
Profile
 
 
Posted: 19 August 2010 03:07 AM   [ Ignore ]   [ # 3 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

Let’s try removing any conditionals for fieldtypes not in use, and adding ones for fieldtypes in use. If you want to display the “pill”, you’d do this:

{if pt_pill}
{display_field}
{
/if} 
Profile
 
 
Posted: 19 August 2010 03:09 AM   [ Ignore ]   [ # 4 ]
Has a Great Personality
Avatar
Rank
Total Posts:  47
Joined  2010-03-27

Annnnd… that worked. Sorry, it wasn’t clear to me immediately that I probably should have removed unnecessary fields and added the custom names on there. smile Thanks for the speedy reply!

Profile
 
 
Posted: 19 August 2010 03:10 AM   [ Ignore ]   [ # 5 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

Wasn’t clear to me either smile

Learning as we go here.

Profile