Forums / General / form creation

form creation

Author Message

srikanth mn

Tuesday 28 July 2009 5:01:50 am

I have created a class called Meeting RFP. it's id is "meeting_rfp". I have template called meeting_rfp.tpl which would override pagelayour.tpl.

problem is i am not able to over the file even after the declaration in override.php

[Meeting RFP]
Source=pagelayout.tpl
MatchFile=meeting_rfp.tpl
Subdir=templates
Match[class_identifier]=meeting_rfp

can anyone help me out how call the class filed in my meeting rfp.tpl...

Max Keil

Tuesday 28 July 2009 4:39:36 pm

Hi,

your override seems to be ok - I think you have placed the template on the right position.

/design/override/templates/meeting_rfp.tpl

Cleared the caches after creating this rule?

Another note: [Meeting RFP] -> change to [MeetingRFP] no whitespaces between the words.

If it not helps you - another way:
Check your override.ini.append.php again - maybe you have another override for the pagelayout in it! Your specific overrides should be placed much more on the top of the file - this little example describes it:

override.ini.append.php

[MyPagelayout]
Source=pagelayout.tpl
MatchFile=mypagelayout.tpl
Subdir=templates

[MeetingRFP]
Source=pagelayout.tpl
MatchFile=meeting_rfp.tpl
Subdir=templates
Match[class_identifier]=meeting_rfp

In this case the mypagelayout.tpl will be shown, even if your current Object is meeting_rfp. After rotate the both rules:

[MeetingRFP]
Source=pagelayout.tpl
MatchFile=meeting_rfp.tpl
Subdir=templates
Match[class_identifier]=meeting_rfp

[MyPagelayout]
Source=pagelayout.tpl
MatchFile=mypagelayout.tpl
Subdir=templates

In this case meeting_rfp.tpl will only be displayed if your content object is type of meeting_rfp otherwise mypagelayout.tpl will be shown.

Mit freundlichen Grüßen
Best regards

Max Keil

____________________________________________________________
eZ Publish Gold Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh

srikanth mn

Wednesday 29 July 2009 5:41:13 am

I have create a class called meeting RFP and it's id=meeting_rfp. I have two attributes with ID
first_name and surname. how do i call this class in any template and display fist name and sirname fields......?

Max Keil

Wednesday 29 July 2009 3:35:40 pm

So your override rules already working?

If you call a link which is type of meeting_rfp class you can access the $node variable. This variable is automatically set by eZ Publish on the node view.

The attributes stored in this node are placed in $node.data_map:

{attribute_view_gui attribute=$node.data_map.first_name}
{attribute_view_gui attribute=$node.data_map.surname}

This displays the datatype view of this attribute. In most cases you can directly access the content by:

{$node.data_map.first_name.content}

You can also check if your variable has some content by:

{if $node.data_map.first_name.has_content}
...
{/if}

Try to use the attribute(show) operator for the variables it displays you the whole dump for this variable.
{$node.data_map.first_name|attribute(show)}
In most cases it helps you to resolve the problem.

Mit freundlichen Grüßen
Best regards

Max Keil

____________________________________________________________
eZ Publish Gold Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh

srikanth mn

Thursday 30 July 2009 7:07:20 am

No it's not working....

I have created the article it's node id is 145, where i am displaying some content....below this i want to display the form of meeting rfp where i have created the class with id meeting_rfp.
Meeting RFP is menu link...i am calling this as below

<a href={'/content/view/full/145' |ezurl()} class="menu">Meeting RFP</a>

my override is

[Meeting]
Source=pagelayout.tpl
MatchFile=meeting_rfp.tpl
Subdir=templates
Match[class_identifier]=meeting_rfp

now when i click on Meeting RFP it just fetch the content in article node 145 but it does't display any form......following is the code in Meeting RFP

--------------------Code------------
{$module_result.content}

{attribute_view_gui attribute=$node.data_map.first_name}

{attribute_view_gui attribute=$node.data_map.surname}
--------------End of code----------

can any one please help me where i am going wrong

Paul Wilson

Thursday 30 July 2009 8:23:03 am

Hi Srikanth,

You might find my article on forms useful.

See: http://ez.no/developer/articles/how_to_create_ez_publish_forms

hope that helps

- Paul

Max Keil

Thursday 30 July 2009 11:13:16 am

Hi,

are you trying to override the pagelayout.tpl for every class? Is it required?

Here are some information about the pagelayout:
http://ez.no/doc/ez_publish/technical_manual/4_0/templates/the_pagelayout

override.ini.append.php

[MeetingRFP]
Source=pagelayout.tpl
MatchFile=meeting_rfp_pagelayout.tpl
Subdir=templates
Match[class_identifier]=meeting_rfp

This rule overrides the pagelayout if a node of class meeting.rfp were displayed.

$module_result is a variable inside the pagelayout. with:

{$module_result.content}

inside the pagelayout you can display the content of your node!!!

to override the template that is displayed for $module_result.content you should use this:
override.ini.append.php

[MeetingRFP_class]
Source=node/view/full.tpl
MatchFile=full/meeting_rfp.tpl
Subdir=templates
Match[class_identifier]=meeting_rfp

Now your pagelayout is placed in: /design/plain_site/override/templates/meeting_rfp_pagelayout.tpl
With the last override rule you matches the content inside of $module_result.content.
And this is the template: /design/plain_site/override/templates/full/meeting_rfp.tpl

Inside of this content template you can use $node variable!

Mit freundlichen Grüßen
Best regards

Max Keil

____________________________________________________________
eZ Publish Gold Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh

srikanth mn

Friday 31 July 2009 6:35:54 am

I am able to display only send button....following is the code in meeting rfp page

{* Meeting RFP - Full view *}

{* form introduction *}

<form method="post" action={"content/action"|ezurl}>

{* Given Name *}

<h4>{$node.data_map.given_name.contentclass_attribute.name}</h4>

<div class="attribute-given-name">

{attribute_view_gui attribute=$node.data_map.given_name}

</div>

{* Form buttons - Processing *}

<div class="content-action">

<input type="submit" class="defaultbutton" name="ActionCollectInformation" value="{"Send form"|i18n("design/ezwebin/full/feedback_form")}" />

<input type="hidden" name="ContentNodeID" value="{$node.node_id}" />

<input type="hidden" name="ContentObjectID" value="{$node.object.id}" />

<input type="hidden" name="ViewMode" value="full" />

</div>

</form>

can any one tell where i am going wrong....

Max Keil

Friday 31 July 2009 2:27:04 pm

If your override.ini is like this:

[MeetingRFP]
Source=pagelayout.tpl
MatchFile=meeting_rfp_pagelayout.tpl
Subdir=templates
Match[class_identifier]=meeting_rfp

the you have to fetch the node before you can use it in 'meeting_rfp_pagelayout.tpl':

{def $node = fetch( 'content', 'node', hash( 'node_id', #NODEID# ) ) }

but if your override.ini is like this:

[MeetingRFP_class]
Source=node/view/full.tpl
MatchFile=full/meeting_rfp.tpl
Subdir=templates
Match[class_identifier]=meeting_rfp

you can use the $node variable inside of 'meeting_rfp.tpl'

<form method="post" action={"/content/action"|ezurl}> - do not forget the leading slash!

Is your attribute called given_name?

Mit freundlichen Grüßen
Best regards

Max Keil

____________________________________________________________
eZ Publish Gold Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh

srikanth mn

Monday 10 August 2009 12:05:01 am

How to create Radio button while creating class and how to call this in tempelate