Forum for discussing general topics related to Couch.
7 posts Page 1 of 1
Hi guys!

Submitting form content from a popup (I'm using jquery.leanModal.min.js) causes the refresh of the page so there is no way to display success or error message for the user. Is there a way to display these messages or using iframes is the only solution.
I'm using successfully the js with iframe for member registration but now I'm trying something else which needs member id, and I don't know if it's possible to get a member's id from page view and use it in list view to submit form content.
We were talking about this problem in another thread when @cheesypoof explained that you have to interrupt the form submission and send an AJAX request instead. viewtopic.php?p=19931#p19931 Maybe that will help you.

I don't know if it's possible to get a member's id from page view and use it in list view to submit form content.

The cms:pages tag will give you access to all the variables available in page view. But if you need the currently logged in member's id, that variable is available globally. Try cms:dump to see what variables are available.
atisz wrote: Hi guys!

Submitting form content from a popup (I'm using jquery.leanModal.min.js) causes the refresh of the page so there is no way to display success or error message for the user.

Oh my! Reading again my post, just realized I have wrote something else, not what I wanted. :( The problem is not caused by the popup, in fact submitting form content in Couch causes the refresh of the page so there is no way to display success or error message for the user, if submitting form from a popup window.
tim wrote: We were talking about this problem in another thread when @cheesypoof explained that you have to interrupt the form submission and send an AJAX request instead. viewtopic.php?p=19931#p19931 Maybe that will help you.

Thank you @Tim for your feedback. Unfortunately I have never used Ajax, so if the only solution is using Ajax I wont be able to do it :(
tim wrote: The cms:pages tag will give you access to all the variables available in page view. But if you need the currently logged in member's id, that variable is available globally. Try cms:dump to see what variables are available.

As I don't need the currently logged in member's id but another member's id, I don't think is possible to get the member's id from he's profile page and pass it to another page's list view and use it with a databaound form.
If you are on a member's profile page, then surely the id is available and can be appended to the URL of the other template's list view:
Code: Select all
<a href="<cms:link 'another-template.php'/>?id=<cms:show k_page_id/>">Do something with this member</a>

In the other template you just retrieve this with:
Code: Select all
<cms:gpc method='get' var='id'/>

It is not entirely clear to me what you are trying to accomplish though @atisz. Perhaps you could provide more information?
cheesypoof wrote: It is not entirely clear to me what you are trying to accomplish though @atisz. Perhaps you could provide more information?


Thanks for the tip @cheesypoof! What I'm trying to accomplish is to send PM to other registered members from a popup window, using jquery.leanModal.min.js. I have placed a Send PM button on members/index.php page which clicked brings up the popup window containing the databound form. Sending PM works, but on sending the message the user didn't get any confirmation or error message, because of page refresh. Using iframe in the popup is allowed (actually this is how I implemented user registration), so I thought if is possible somehow to get the (receiver) member id from members/index.php and pass it to another page, then I could embed this page with an iframe into the popup and this way the sender will receive the confirmation or error messages on form submit. Maybe it sounds a little too overcomplicated, but because I have no ajax knowledge, this seems to be the only way I could display the appropriate message on form submit.
Try the set_flash and get_flash tags documented at viewtopic.php?f=5&t=7377. You may need to enable the 'addons/cart/session.php' module in your kfunctions.php. If this doesn't work, do post the relevant form code.
7 posts Page 1 of 1