Here's a link to my newest module: http://drupal.org/node/37339

Whilst I know I should be concentrating on my other module which needs a whole lot more work, I feel that taking a break from it has given me more ideas about how to handle it which is all good :o) But not what this post is about...

In my newest module, on the page: http://drupal.org/project/Modules My module has the embarrassingly longest preview... I've completely forgotten how to put my own line break in it, could somone please let me know!!! :o) Thanks!

The module works fine as it is, but I've been perfecting it ;o) I've come across a problem though with the way I've done something with it. Here's an example (easier to follow than the real code!):

function tablemanager_tableadd() {
if(isset($_POST['create'])) {
if (!form_get_errors()) {
//create db entry
}
}
if(isset($_POST['submit'])) {
if (!form_get_errors()) {
//display fields and let user name them
//make 'create' button
}
}
//main code
//allow user to name table and set how many columns are in table
//make 'submit' button
}

Now all that works absolutely beautifully :o) Unless the user enters something the validation doesn't like... For the first screen it's fine because the code 'runs though' into the first part and marks the box in red where there's been an input error. However for the second screen, when the user makes a mistake they're sent back to the very first screen because the second screen is 'hidden' by the isset($_POST['submit']) statement. I was under the impression that I could set the POST variable manually so that the user will be nicely shown what he's entered wrongly? If I type:

$_POST['submit'] = "Submit";
if (isset($_POST['submit'])) {
print "test";
}

Then it does indeed print out "test"... So how comes when I try that in my code it just passes right by the if (isset($_POST['submit'])) statement and displays the very first screen again? I'm assuming because I'm not a php programmer that I'm trying to do something which either isn't possible with the php language or is just accomplished 'another way'...?

Sorry if this isn't easy to follow :o) It's semi-important though and help would be very much appreciated! :o)

Thank you

Pobster
NOTE!!!!! Thank you :o) Have solved the first issue now - found the <!--break--> command!

Comments

pobster’s picture

BTW I know that I'm putting the $_POST['submit'] = "Submit"; command in the right place because if I also add a print "test"; then it gets displays "test" along with taking me back into the first screen again.

Pobster

bwv’s picture

Hello, I uploaded your module and can create headings for the columns for the table I want to create. But how do I enter new data into the table per se? When I type something into the text field, i get an error message telling me that "The specified field contains some illegal code." Perhaps I do not understand how to use the table. Can you please help me out?? Thanks jsb

pobster’s picture

Well... That's because you're entering illegal code into the data fields ;o) Heh! :o) What you enter is checked against what you're allowed to enter via the 'filtered html' option in your input formats. Future versions of my module will actually get you to select which filter you want to apply. (I say future, but I mean by the end of the week more than likely!) Then you'll be able to apply the 'full html' filter assuming you have the correct permissions - it's all about the security you see...

I assume that you can enter just plain text for your data and that the problem is nothing more sinister?

Pobster

venkat-rk’s picture

Interesting module. Should be very helpful for non-programmers mucking around with the inconsistencies of various WYSIWYG editors.

But there seems to be another module that does similar things! Now, which one should I choose?

pobster’s picture

Afraid I think you either misunderstand my module or maybe the other one! The other one (the Tables Filter Module) allows you to put a table into a static page by using markup. This means the table has to be manually created by typing:

[table=tables-grid Month |Jan | Feb | Mar | Apr
East| 7 | 14 | 21| 28
West | 7 | 14 | 21| 28
North| 7 | 14 | 21| 28
South | 7 | 14 | 21| 28 ]

And this only appears on that one static page.

My module on the other hand is a fully featured table creator and involves no mark up or coding yourself other than the print command to display it (on however many pages you like). On mine the tables are stored in the database and can be edited in the admin screen by clicking 'edit' and deleted by clicking 'delete'. You can create and delete as many tables as you like as well.

Not that I'm knocking the other module you understand ;o) I actually really like it and have it enabled for one of my sites. Its very pretty :o) However, I wrote my module because the site admins for another site I have are definitely NOT coders - they struggle a little bit with email ;o) And so I needed to make something user friendly for them to be able to edit the tables themselves and have everything done automatically 'behind the scenes' for them.

Hope that clears it up! Both the modules are useful in their own right and are definitely not similiar!!!

Pobster

venkat-rk’s picture

Thanks, pobster. That cleared up my confusion:-)