Forums / Setup & design / content/action is not currently available

content/action is not currently available

Author Message

Wei Dai

Thursday 17 July 2008 1:00:57 am

Hi,
I create a forum according the article http://ez.no/developer/article/how_to_create_ez_publish_forms.

The submit action is triggered by a javascript use document.formname.submit()

However, after I submit the form, it shows:

Kernel(3) error:

Object is unavailable

The object you requested is not currently available.

Possible reasons for this are:

* The id or name of the object was misspelled, try changing it.
* The object is no longer available on the site.

The form is post to /content/action, because I can see the address in the address bar of my browser.

I have enabled the information from anonymous users.

What is the problem?

Certified eZ Publish 4 developer looking for develop information & collaboration.

Wei Dai

Monday 21 July 2008 9:08:22 pm

It seems that the content/action is stack at the address bar. For example, if you manually enter the content/action in the browser in any working installation of eZ Publish, e.g. http://yourdomain.com/index.php/[siteaccess]/content/action. you will get the exactly error message as mine.

I knew the content/action is not a object. It seems the redirection or displaysettings is not configured right. But, I checked again and again, really can't find what's went wrong. After the form submitted, the information were not collected nor the page redirect to the right address (node, result or url).

Could anyone help me? This is really urgent for me.

Certified eZ Publish 4 developer looking for develop information & collaboration.

André R.

Monday 21 July 2008 11:32:45 pm

You send the form, but do not trigger the correct button, so name / value of button is not sent.
If this is a hidden form, use type="hidden" instead of type="submit" on the button (but only one!!!).

(If you take a look in kernel/content/action.php you'll see that all actions are triggered by the presence of a specific button name).

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Wei Dai

Tuesday 22 July 2008 12:04:52 am

I use a javascript to submit the form: onclick="document.formId.submit();".

Can I do that?

Can I use image input type also?

Certified eZ Publish 4 developer looking for develop information & collaboration.

André R.

Tuesday 22 July 2008 12:12:57 am

post your code.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Wei Dai

Tuesday 22 July 2008 2:11:02 am

Here is the code:

{* Quick Feedback Form - on the top right hand of the content page *}
{* validation *}
{include name=Validation uri='design:content/collectedinfo_validation.tpl'
         class='message-warning'
         validation=$validation collection_attributes=$collection_attributes}
         
<form id="project" name="project" method="post" action={"content/action"|ezurl}>
                <div class="grey_box_small">
                    <div class="grey_box_top"></div>
                    <div class="grey_box_repeat">
                        <div class="grey_box_wrap">
                            <div class="heading2" style="float:none; padding-left:20px; padding-bottom:10px;">{attribute_view_gui attribute=$object.data_map.title}</div>
                            <div class="heading3_2" style="padding-left:20px; padding-bottom:10px;">{attribute_view_gui attribute=$object.data_map.description}</div>
                            <div class="heading5" style="padding-left:20px; padding-right:5px;">{$object.data_map.name.contentclass_attribute_name}</div>
                            <div style="width:100px; float:left; margin-right:25px;">
                                {attribute_view_gui attribute=$object.data_map.name name=$object.data_map.name.contentclass_attribute_name}
                            </div>
                            <div class="heading5" style="padding-right:5px;">{$object.data_map.tel.contentclass_attribute_name}</div>
                            <div style="width:110px; float:left;">
                                {attribute_view_gui attribute=$object.data_map.tel name=$object.data_map.tel.contentclass_attribute_name}
                            </div>
                            <div style="clear:both; height:10px;"></div>                                                
                            <div class="line_h" style="padding-left:150px; margin-top:10px; margin-right:40px;">&nbsp;</div>
                            <div class="submit_btn_wrap" style="float:left;">                            
                            <!--<a href="#" onclick="document.project.submit();" id="ok_projet"><span class="news_more">{"envoi"|i18n}</span></a>-->
                            </div>
                            <input type="hidden" name="ContentNodeId" value="{$object.main_node_id}" />
                            <input type="hidden" name="ContentObjectID" value="{$object.id}" />
                            <!--<input type="hidden" name="ViewMode" value="ObjectRelation" />-->
                            <input type="submit" class="defaultbutton" name="ActionCollectInformation" value="{"Send form"|i18n("design/bysoft/templates/content/view/quick_contact_form")}" />
                        </div><!-- end grey box wrap -->
                        <div style="clear:both;"></div>

                    </div><!-- end white box repeat -->
                    <div class="grey_box_bottom"></div>                 
                </div><!-- end grey box -->
                
</form> 

Certified eZ Publish 4 developer looking for develop information & collaboration.

Wei Dai

Tuesday 22 July 2008 2:33:52 am

the "ContentNodeId" should be "ContentNodeID". I have corrected it.

And I also changed the input type to submit.

However, I got a series messages state that:

Non-static method ... should not be called statically, assuming $this from incompatible context...

The form object was linked into a page via the Object Relation attribute. There is only one of this form instance side wide. I just linked it to the page which need show the form. So, I am not use a node full view template. But I think this should not the problem.

By the way, when I can check which action parameters are required? ContentNodeID, ContentObjectID ...?

Certified eZ Publish 4 developer looking for develop information & collaboration.

André R.

Tuesday 22 July 2008 3:47:30 am

> By the way, when I can check which action parameters are required?

By reading the code(there is no documentation on this part of ezp), searching for ActionCollectInformation gives you:

    else if ( $http->hasPostVariable( "ActionCollectInformation" ) )
    {
        return $module->run( "collectinformation", array() );
    }

witch is inside:

else if ( $http->hasPostVariable( "ContentObjectID" )  )
{

In collectinfo.php you'll find:

if ( $Module->isCurrentAction( 'CollectInformation' ) )
{
    $ObjectID = $Module->actionParameter( 'ContentObjectID' );
    $NodeID = $Module->actionParameter( 'ContentNodeID' );
    $ViewMode = 'full';
    if ( $Module->hasActionParameter( 'ViewMode' ) )
        $ViewMode = $Module->actionParameter( 'ViewMode' );

To see what post parameters that maps to these action parameters you'll have to look in module.php:

    'single_post_actions' => array( 'ActionCollectInformation' => 'CollectInformation' ),
    'post_action_parameters' => array( 'CollectInformation' => array( 'ContentObjectID' => 'ContentObjectID',
                                                                      'ContentNodeID' => 'ContentNodeID',
                                                                      'ViewMode' => 'ViewMode' ) ),

When it comes to the button, if you do not actually click on this:

                           <input type="submit" class="defaultbutton" name="ActionCollectInformation" value="{"Send form"|i18n("design/bysoft/templates/content/view/quick_contact_form")}" />

It will not be sent, so to fix: either click on the button or change it to type="hidden"

If you still get the "Non-static method", please post all the details!

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Wei Dai

Friday 25 July 2008 2:28:46 am

Hi, thanks for your help.

Right now I have worked out the form. I have added the Enhanced eZBinaryFile extension to enable the file upload in the contact form.

I need disable the display errors in php configuration to prevent all the strict warning to show up. The Enhanced eZBinaryFile extension was not developed for eZ 4! But right now, it basically works (except a problem with the version management of the content object created with this datatype. You get a fetal error on discard draft or delete older versions of the object).

I searched around, and find currently, this extension is the only thing that let your enable upload/file element in the form on the front end. Will it be upgrade for eZ 4?

One another thing is, I can't get the form validation work, even I have included the validation template as the code shown above. But, when submit form with empty, I didn't get the template with error message, nor the information was collected.

P.S. I am an PHP developer who find that eZ Publish is very odd. I want to know where I can find which information that is useful for get start to develop with eZ Publish? Not the template development, just PHP development. Thanks.

Certified eZ Publish 4 developer looking for develop information & collaboration.

Wei Dai

Wednesday 06 August 2008 12:06:05 am

I used some javascript to do the validation on the client side.

The form data are not submitted or collected, it just show a empty page; not validation error message since I seem can't load the validation template. The code call the validation template are shown above. can someone tell me what's wrong?

Certified eZ Publish 4 developer looking for develop information & collaboration.