Don't publish content with selection attribute value 'Select'

Author Message

Romeo Antony

Sunday 19 December 2010 2:10:09 am

Hi all,

I wouldn't like to publish contents with selection attribute value "Select"

Contents will be only published if selection attribute value is something else.

So I need to edit the selection datatype's edit view file , to get this done.

Can anyone please help me further. Bez I am bit slow in catching ez API classes

Steven E. Bailey

Sunday 19 December 2010 3:11:07 am

Are you sure you just don't want to set this attribute to required which will reject any blank input?

If it really has to match and reject on some other value than blank (and you aren't setting the value and id of your dropdown to select are you - that would be an easy template fix) - then I would suggest creating another datatype to handle this instead of mucking around with the ezselection datatype.

If you REALLY must edit the ezselection type (i.e if you tons of existing ezselection types that have to follow these rules if they are edited), then look at kernel/classes/datatypes/ezselection/ezselectiontype.php at the validateObjectAttributeHTTPInput function. That would, I think, be the most logical place to add additional validation.

Certified eZPublish developer
http://ez.no/certification/verify/396111

Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com

Romeo Antony

Sunday 19 December 2010 3:41:29 am

Thanks for the reply Steven.

"Are you sure you just don't want to set this attribute to required which will reject any blank input? "

I have set up selection attribute as required(single selection).

And values like as follows

Select

Value1

value 2

Value3

So always ezselection attribute value (Select) will be displayed when I start creating an object with selection atribute.

As you told , Steven I have put a optionvalue 1 as blank , means no value for option1

then option2, option3 ... .But when publish the content with selection attribute value as blank, it got publishsed even if it is required.

"(and you aren't setting the value and id of your dropdown to select are you - that would be an easy template fix)"

This only can select a specific option value will be selected . Right?.

For now , editing ezselection datatype is the solution, as you told me .

, just going to /ezselectiontype.php at the validateObjectAttributeHTTPInput function.

Thanks for the tip

Steven E. Bailey

Monday 20 December 2010 3:03:50 am

It doesn't make much sense to me to put the null value in the attribute. We mostly solve this by overriding the edit ezselection with something like this:

<option value=""> {"Select:"|i18n('design/whatever')}</option>

{foreach $attribute.class_content.options as $index}

<option value="{$Options.id}"> {$option-name[$index]}</option>

{/foreach}

Certified eZPublish developer
http://ez.no/certification/verify/396111

Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.