Problems, need help? Have a tip or advice? Post it here.
8 posts Page 1 of 1
Hi

We have created 2 clonable pages (groups & applications). In the application page we have set up a relation with the groups page. Using this relation a user can select specific groups inside individual applications.
We need to display these groups in the front page. We have used the following code
Code: Select all
<cms:pages masterpage='applicationmaster.php'>
<cms:related_pages 'groupmasternew_applicationmaster' >
<cms:show k_page_title /><br>
</cms:related_pages>
</cms:pages>

This works fine, however with this the group titles appear one below the other. We need to display them in a drop down. Tried using the below code however it didnt work
Code: Select all
<cms:pages masterpage='applicationmaster.php'>
<cms:related_pages 'groupmasternew_applicationmaster' >
<cms:input
name='drop_d'
type='dropdown'
opt_values="<cms:show k_page_title />"
/>
</cms:related_pages>
</cms:pages>

Can anyone let us know what is the error in the above & a solution for this.

Cheers
Alok
@Alok

Can you please share your relation editable region code?

Regards,
GenXCoders (Priya)
Image
where innovation meets technology
In the application master page we have added the following code

<cms:editable type='relation' name='groupmasternew_applicationmaster' masterpage='groupmasternew.php'/>
Hi!

So you are doing a Many-to-Many relation.
<cms:editable type='relation' name='groupmasternew_applicationmaster' masterpage='groupmasternew.php'/>


By Default in the front end it will appear as a dropdown while in the backend as a checkbox list.

Now coming to your problem:
Insetad of:
Code: Select all
<cms:input
name='drop_d'
type='dropdown'
opt_values="<cms:show k_page_title />"
/>


Can you please try:
Code: Select all
<cms:input
name='groupmasternew_applicationmaster'
type='bound'
/>

and let us know.

Regards,
GenXCoders (Priya)
Image
where innovation meets technology
HI

This isnt working. We are getting the following error.

ERROR: Tag "input" of type 'bound' needs to be within a Data-bound form

Alok
Hello.

My mistake. I thought that since you are using relations you might also be using the Databound Forms.

No issues. I just went thought your code again.

Please revert back to your earlier code, i.e.:
Code: Select all
<cms:pages masterpage='applicationmaster.php'>
    <cms:related_pages 'groupmasternew_applicationmaster' >
        <cms:show k_page_title /><br>
    </cms:related_pages>
</cms:pages>

and change your editable region to:
<cms:editable type='relation' name='groupmasternew_applicationmaster' masterpage='groupmasternew.php' has='one'/>


I am suggesting this as you are just wanting to display a drop down on the front end. The editable region you had defined is a many-to-many relation type. The change I have suggested above will make it a many-to-one relation type. (Please refer to: Relationships for understanding the relation types.)

Again, to mention, the change in the editable region I have suggested above suggested keeping in mind that you want to display a drop down in the front end. I or any other member would be able to provide a better solution if you could share your use case in detail.

Please let me know if this helps!

Regards,
GenXCoders
Image
where innovation meets technology
Hi the above code is resulting in the drop down changes to a list view. Any solution for that.
Hi Alok,

To dynamically populate a dropdown, we can use the technique described in the following thread -
viewtopic.php?f=4&t=10316#p25126

The point being made in the mentioned thread is that the 'opt_values' parameter of the dropdown can be dynamically filled to populate the dropdown.

In your case, we can do that using <cms:pages> code e.g. as follows -
Code: Select all
<capture into='my_options'>
    <cms:pages masterpage='applicationmaster.php'>
        <cms:related_pages 'groupmasternew_applicationmaster' >
            <cms:show k_page_title /> |
        </cms:related_pages>
    </cms:pages>
</cms:capture>

<cms:input
    name="my_dropdown"
    label="Related Groups"
    opt_values="<cms:show my_options />"
    type="dropdown"
/>

Please notice that we are using a 'pipe' separator instead of <BR>.

Hope this helps. Do let me know.
8 posts Page 1 of 1