I wanted to place the subscription interface block in a tab, and I was wondering if there was any way to have the subscriptions interface tab make an ajax request so that the entire page doesn't have to refresh and the tabs reset) when a selection is saved?

Trevor

Comments

salvis’s picture

Which path (URL) are you referring to?

break9’s picture

I do not understand the question?

salvis’s picture

Where do you want to create a tab? On http://example.com/node/NID ? Like "View, Edit, Subscribe"? With "Subscribe" being at http://example.com/node/NID/subscribe ?

There is currently no AJAX functionality.

What do you mean with "tabs reset"? That you're being redirected back to http://example.com/node/NID ? You can change that in the submit handler.

break9’s picture

url is presently http://example.com/node/NID.....

I used;

<?php
if ( arg(0) == 'node' && is_numeric(arg(1)) && ! arg(2) ) {
$node = node_load(arg(1));
}
?>

<?php
if ($user->uid == ""){
?>
<a href="../user"><img src="../sites/all/themes/example/images/subscription.jpg"></a>

<?php
}else{
print drupal_get_form('subscriptions_ui_node_form', $node);
}?>

inside a custom block. Then I called that block with quicktabs and I used the following;

<?php
$qtid = 13; 
$quicktabs = quicktabs_load($qtid);
print theme('quicktabs', $quicktabs);
?>

in contemplate to call it into the template file and format it.

Yes I am being redirected to the http://example.com/node/NID when i save but........I envision using the block in several different locations so having it save via ajax would stop the page refresh each time you saved the subscription form, and allow me to use it in many locations without configuring a submit handler for each instance(if that is even possible, i am not sure).

Trevor

salvis’s picture

Category: feature » support

I'm not familiar with quicktabs or contemplate, and I can give you only general advice.

The usual way to do this is to hook_form_alter() and add your own submit handler (which calls the original submit handler) to redirect wherever you want.

Unless you (or someone else) actually want to work on changing the subscriptions_ui.module to use AJAX, I can't take this as a feature request. It's just not going to happen.

break9’s picture

Ok, I will see what I can come up with. If I manage a patch or a solution I will post it back here.

Trevor

gregarios’s picture

subscribing.

Actually, I don't think the original poster here has any problems with tabs, as his symptoms are only a normal result of a full page reload.

He is simply asking to have the subscription form block use Ajax so a page reload doesn't have to occur every time someone uses the subscription form. An Ajax call would essentially set the form information in the database, in the background, without doing the page reload of a normal form submittal.

salvis’s picture

@gregarios: Yes, I agree with your interpretation. I was trying to better understand the OP's requirements and to give some ideas on how to implement them given the current no-AJAX interface.

If someone wants to implement this I'm open to review patches. Please assign yourself before you start.

salvis’s picture

Issue summary: View changes
Status: Active » Closed (outdated)