This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

AJAX custom autocomplete

See http://drupal.org/node/42552 for reference.

I have done everything (I think) but I still get a 403.

My new module is called "newmodule.module".

I have put the following in "newmodule.module":

/**
* Retrieve a pipe delimited string of autocomplete suggestions for existing plannames
*/
function newmodule_autocomplete($string) {
  $matches = array();
  $result = db_query_range("SELECT name FROM {users} WHERE LOWER(name) LIKE LOWER('%s%%')", $string, 0, 10);
  while ($user = db_fetch_object($result)) {
    $matches[$user->name] = check_plain($user->name);
  }
  print drupal_to_js($matches);
  exit();
}

and, in the newmodule_menu function:

	 $items[] = array('path' => 'newmodule/autocomplete', 'title' => t('newmodule autocomplete'),
      'callback' => 'newmodule_autocomplete', 'access' => $view_access, 'type' => MENU_CALLBACK);

Finally, I have put, in the $form['fieldset1']['field'] array:

'#autocomplete_path' => 'newmodule/autocomplete',

I get a 403 with: http://...../newmodule/autocomplete not found.

If I put that address in the address bar, indeed, it doesn't work.

However, the example in Tutorial 1 works fine (using the pre-existing user_autocomplete) in newmodule. That is, if I use:

'#autocomplete_path' => 'user/autocomplete',

My textfield autocompletes (with user names, of course) just fine.

taxonomy

i want a block on the right hand side to display, all the terms in my taxonomy... ia m so confused..... why this option is not there?

i enabled taxonomy then i created a term... how do i make all those terms show up in a block? is there an option some where..

Forms text field not respecting length

Why isn't the form text field respecting the length I set?

$form['value'] = array(
    '#type' => 'textfield',
    '#title' => t('Value'),
    '#size' => 3,
    '#maxlength' => 3,
'#required' => TRUE,
    '#description' => t('1-100'), );

Yet when I display that the field extends the width of the form...not just 3 characters.

Filters and trimmed content on frontpage

Hello,

I'm developping a filter for my drupal website and am facing some difficulties. For reasons of simplicity, I'll refer to the footnotes filter which is also causing me some problems, for the exact same reason.

I find disturbing having some footnotes appearing on my frontpage, when only a short trimmed version of my article's content is displayed. I am wondering if there is a way to modify the way my filter works when it is applied to the full article and when it's only used in the trimmed version.

From what I understand after searching a bit on the forums, there is no way of achieving this...
(actually the kind of solution I need is something like the ability to define an input-format for the full article and one for the trimmed version [even though I doubt that's the best way to deal with it]).

One thing I can do is convert my module to a node one, but once again I don't feel it's the right way to deal with this...

Another idea could be to put a special tag in the end of the text (that wouldn't be in the trimmed version, considering that the article is long enough), and change the behaviour of my module.

Anyway, there are some workarounds, but I don't want to start tweaking around. Is there a correct/clean way of doing this (not necessarily in my module, since as I said I want to apply this to `footnotes` too) ? If not, any suggestions on how to achieve this ?

Location API doesn't seem to insert or update...

Hi Folks,

I've developed a 'student' node module with which I'm trying to use the Location API to save its address information. In my student_form() hook I use the location_form() hook to collect the student's address like this:

$form['address']['address'] = location_form(array('street', 'additional', 'city', 'province', 'postal_code', 'country'), $node->location ? location_api2form($node->location) : array(), array('street', 'city', 'province', 'postal_code', 'country'));

The Problem

The location form displays nicely within my student form but the location data never seems to save. I've tried calling location_nodeapi() in my student_insert() hook but that didn't do the trick either (I didn't think I had to explicitly call location_nodeapi() anyway so I was pretty sure that wasn't the problem). I've combed through location.module, location_API.txt, location.inc and much of drupal.org but can't get my hands on an answer.

What I Do Know

I know the location.module is alive and well though because it saved just fine when I tested it with a custom content-student node I built using the CCK. Also, location_nodeapi() does fire its validate, prepare, view and load operations when I create and edit students, so, I'm getting some response from it, just no 'insert' or 'update'. For what it's worth, I'm also trying to get the Image Assist API to work in the same way and am having the same problem with it.

Abyss web server and Scriptaculous

** I apologize for posting this here in "module development" instead of "post installation.. **
** Somehow this forum seems more appropriate for my particular scripting question **

I cannot get the Spajax module working properly on my local web site. It works great on my remote site.

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions