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

How to validate form elements (In a modified, but existing form) using 4.7 forms API?

Okay, perhaps I'm just easily confused, but I cannot make heads or tails out of form validation.

I am attempting to perform validation on a field that has been added to an existing form.

I've added a textfield to the form that appears on admin/settings/content-types/(nodetype), and I want to be able to make sure that a positive integer is entered into that field.

I'm attempting to create a very simple module to limit the number of nodes that can be created per user, per node type, and I wanted to add a field to the admin/settings/content-types/(nodetype) page, where the admin could enter an integer for how many nodes of that type that each user could create.

Now, the easy part was creating the alter_form thingy, to add the appropriate field to the form. I got that working just fine. It saves to the database properly and everything.

But then I wanted to make sure that the admin entered an a positive integer or zero. Glancing through the API, I'd seen an attribute for form elements, "#validate", and thought it would be simple. Here I sit, eight hours later, completely frazzled.

The sample code on the Forms API Reference page either doesn't work, or I completely don't understand it.

The code in the Forms API FAQ entry (http://drupal.org/node/36899) under "How do you use the #validation arguments?" doesn't even _look_ like it would work (no quotes around #valid or #validation arguments)

categories broke edit - i disabled, now site gone.

I had just started putting a new site together with 4.7 from CVS from a couple weeks ago.

I am sort of new to Drupal but was pretty sure I needed to use tox to classify my nodes. I have only added a few nodes so far but had added terms to them. I then started to try out a couple other tox mods to see how this all worked; I had the tox_block and tox_theme mods working fine.

Then I figured I should likely start looking at categories since I thought this was likely the way I SHOULD be doing this.

I went through install process (even though I think install.txt is a bit confusing) - but I think I did things correctly. I imported my existing nodes from one vocab to a category. This worked fine.

NOW... the issues:

- some of my nodes don't show up as orphans - no big deal

- when I am logged in as admin and I go to a node - I can no longer EDIT the node

- I read a post about this and someone suggested disabling/enabling categories to fix this.... OOOPS!!

- once I disabled "Categories" module and hit save; my site was gone.

I get " Call to undefined function: category_select_nodes()"

So I guess it makes sense that I wouldn't be able to find this function since I just disabled it - but pretty sure it shouldn't kill my site.

Hopefully just removing the category mod will repair this - but I kinda doubt it... stay tuned...

Have I installed something incorrectly here?

NOTICE-BOARD

How do you do!
We Beg pardon for my english since write by means of translator.
I interest the module a NOTICE-BOARD for accomodation of information on car, there is such marketed under Drupal.
Respectfully yours, Mihail.

Block access control and database

I'm modifying block.module to allow Drupal to display blocks based upon the role a user is assigned. I have this code:

  $rroles="SELECT name FROM role";
  $rrroles = db_fetch_array(db_query($rroles));
  
	   foreach ($rrroles as $reles => $names) {
		    $options = array();
		    $options[] = t($names);
	    }

But it only returns one result. I've tried a while loop but the page hangs. All help would be deeply appreciated.

Wordfilter

I installed wordfilter and added some of the standard words. I am assuming wordfilter works, but I was a bit taken aback when I notced that the offending words are listed on the compose tips page.

How do I take them off of there?

layout fix - suppress side blocks in this page?

Hi

I have a problem with a table over-lapping the side block.
http://urbits.com/_test/table_over.gif

So far, when I've needed to customise a page, it's been adding something in - that's going ok. But in this case I assume I need to understand is how blocks are suppressed on an adhoc basis. Is there an unhook_block() function (does that show my newbiness?)

Pages

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