Insert new Rows
Permalink
Hello, I am trying to build a custom block that basically turns my "Sidebar" section into an area for updates and things like that. Basically when you add the block it asks for the first update to get the ball rolling. Then, when you edit the block I either would like for it to give a button to click to add a new update or allow you to edit the old updates.
What I am having trouble with is if I put in a button and give it any onClick behavior it submits the entire form. I know there is a way to over-ride this but I guess I'm missing it?
Also, say I just decide to automatically include a new field to add a new update without the need to press a button to get to that... how do I make the edit window understand that when I press update that it needs to check that new field and if something is there to insert it as a new row in the table?
I am having major trouble finding anything out there about building custom blocks. The tutorial on this page was a good start for doing exactly what the example showed and maybe changing the names or something in it but not much more. Where can I find lists of things like what more can I do by adding $form->???? or what other options have I got? The API documentation is rather confusing too, maybe its in there?
Thanks!
What I am having trouble with is if I put in a button and give it any onClick behavior it submits the entire form. I know there is a way to over-ride this but I guess I'm missing it?
Also, say I just decide to automatically include a new field to add a new update without the need to press a button to get to that... how do I make the edit window understand that when I press update that it needs to check that new field and if something is there to insert it as a new row in the table?
I am having major trouble finding anything out there about building custom blocks. The tutorial on this page was a good start for doing exactly what the example showed and maybe changing the names or something in it but not much more. Where can I find lists of things like what more can I do by adding $form->???? or what other options have I got? The API documentation is rather confusing too, maybe its in there?
Thanks!
Thanks so much. That file you sent was really helpful. Did you write it? As I am learning how to do all of this I am going to try and put together tutorials for things so other people down the road don't have to struggle so much to find things out.
Also, I don't know if this answers my original question or not (maybe I am missing it). After I create my form and use the helper how do I disable the update button originally in my "edit" box? Or... (I clearly haven't had a chance to play with this yet) if I add in:
will it automatically submit to the url I supply regardless which button is pressed?
Thanks again.
- Jesse
Also, I don't know if this answers my original question or not (maybe I am missing it). After I create my form and use the helper how do I disable the update button originally in my "edit" box? Or... (I clearly haven't had a chance to play with this yet) if I add in:
echo $form->action($url,$task);
will it automatically submit to the url I supply regardless which button is pressed?
Thanks again.
- Jesse
I don't understand you problem in the first section, but I can help with the form helper. I have a little doc that might help clarify somethings. See the attachment.