By petiar on
Hi everybody,
long waiting for final CCK & Views modules forced me to create my own one. I would like to use the autocomplete feature in one of the form's fields, however, when I start typing in it I am getting js alert window with 403 error (access denied, or sth similar).
I've been googlin' a bit but I wasn't able to find appropriate answer. One reason for this might be clean URLs, but I don't use them. If you have any idea what might be wrong I would appreciate your help. This is my kalendar.module code:
<?php
function kalendar_autocomplete($string) {
$matches = array();
$result = db_query_range("SELECT nid, title FROM {node}");
while ($node = db_fetch_object($result)) {
$matches[$node->name] = check_plain($node->name);
}
print drupal_to_js($matches);
exit();
}
//
// and this is what I have in kalendar_menu:
//
$items['kalendar/autocomplete'] = array(
'path' => 'kalendar/autocomplete',
'title' => t('kalendar autocomplete'),
'callback' => 'kalendar_autocomplete',
'access arguments' => array('create kalendar'),
'type' => MENU_CALLBACK
);
?>
Thanks,
Petiar
Comments
please make sure you have
please make sure you have the authentic to access this url, then empty the table cache_menu
http://universalsoft.org (universal soft, focus on drupal's development)
Authentic to access?
Hi txg0_0,
thanks for your reply. Would you be, please, able to explain what you mean by saying 'authentic to access'? I suppose you mean to check whether the user posting a node is allowed to access that URL. But I am trying to do this as the admin user and I think admin should be allowed to access any URL on the page. If not, what exactly should I check? Where exactly are these permissions set? Do I need to do this in my kalendar_perms hook? How?
I am sorry for the amount of questions, but I am newbie in Drupal modules development. And thanks for the hint with cache_menu table.
Thanks,
Petiar.
http://petiar.sk
--
Petiar
http://petiar.sk
I've tried everything...
Hi again,
I've tried everything - access permissions, emptied the cache_menu table, but I still have that problem. Any other ideas? Thanks.
http://petiar.sk
--
Petiar
http://petiar.sk
Why don't you try: 'access'
Why don't you try:
'access' => user_access('access content')
instead of the 'access arguments' line
And in your form:
'#autocomplete_path' => 'kalendar/autocomplete/'
I'm having the same problem.
I'm having the same problem. Tried the steps outlined above without any luck. Any other ideas?
--
Peter Törnstrand, Happiness