Problems, need help? Have a tip or advice? Post it here.
7 posts Page 1 of 1
Hello All!

I am trying to implement CRUD on a single page.
I have the Create and List implemented using custom routes on the same page. And both are functioning well.

My list view is a table that shows Edit and Delete buttons. Clicking the button trigger a bootstrap modal.

My issue is:
1. If i use
Code: Select all
<cms:route_link 'edit_rat' rt_id=k_page_id />

the entire page with the header and footer is displayed.

2. if i use cms:pages on modal it generates as many modals as the pages. Which will become troublesome when the number of pages grow.

3. If i embed the route
Code: Select all
<cms:embed 'rating/edit_route.html' />
in the modal body then it says ERROR: Tag "form" - page_id required

I just want to achieve:
1. single modal to display all the pages, upon button click trigger.
2. display only the content (form) of edit_route.html or delete_route.html in the modal body (without the header and footer, i do not want feel it is a right way to use a conditional statement in header or footer to hide the unnecessary.)

Any help will be greatly appreciated.

Regards,
GenXCoders (Aashish)
Image
where innovation meets technology
I will try to explain Graphically what I am trying to achieve:

My basic page will display Create form on left side (done) and List view on right side (done)
c1.png
c1.png (10.6 KiB) Viewed 1740 times


In the list view i have two buttons per data: "Edit" and "Delete"
c2.png
c2.png (6.45 KiB) Viewed 1740 times


When i click the "Edit" button a modal should pop-up and show the edit_route (i.e. edit form).
c3.png
c3.png (7.54 KiB) Viewed 1740 times


I am able to display the edit_route (edit form) but it comes along with the header.html and footer.html (from the snippets folder). I only want the form to appear in the modal. But am not able to do so.

Any help would be appreciated.

Regards,
GenXCoders (Aashish)
Image
where innovation meets technology
Hi Aashish,

What content gets returned when a particular view (or route) is invoked is *totally* your prerogative (i.e. Couch doesn't care or insist in the least as to what gets generated).

You can edit your edit_view and make it return only the form; if you need that view to do this only when invoked through AJAX, you may use <cms:is_ajax> to figure out if this is the case and them send back the minimal layout.

i do not want feel it is a right way to use a conditional statement in header or footer to hide the unnecessary.
Where conditionals are required to do the job, you should put them into use.
You want to load form data in the modal dynamically. The code is not complicated, but to fit everything in both your CustomRoutes scheme and custom HTML in your app would require some attention, so I suggest that $40 can bring me onboard for a complete working solution of Edit modal.
Depending on the modal's script, it can be done via ajax or iframe. Iframe solution is easier, because the idea here is to open a certain URL in iframe, which is easy to debug - requesting the same prepared link in browser should display the desired edit form - this is what @KK meant by saying "You can edit your edit_view and make it return only the form". Ajax solution is more complex and involves JS scripting. One good example of it is the ajaxified popup modal from the Couch Cart.
@KK Sir:
Can you please point me to a post explaining <cms:is_ajax />?

@trendoman:
:shock:
Image
where innovation meets technology
genxcoders wrote: @trendoman:
:shock:

:o
@genxcoders -
<cms:is_ajax /> tag returns true or false depending on whether the page it is located in was access indirectly through JS (i.e. vis AJAX) or normally. Example usage -
viewtopic.php?f=8&p=19767#p19767

Hope it helps.
7 posts Page 1 of 1
cron