Options for $Sender->Form->Save() - any insert option available to this function. @x00 maybe

peregrineperegrine MVP
edited May 2012 in Vanilla 2.0 - 2.8

Is there an option that allows form save to insert an entry, instead of just updating a database table?

or a delete row if form is empty?

I am using this function built into the core, but it will only modify a row that exists, it won't create one. Do I have to manually insert a row first? or can it be done with an option to form-save()

I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Best Answer

  • x00x00 MVP
    Answer ✓

    this is handled in the post back, I would search for plugin that save config options and other things. It doesn't necessary follow a present schema. You validate, and insert wherever.

    grep is your friend.

Answers

  • peregrineperegrine MVP
    edited May 2012

    @businessdad any ideas. you seem to know your way around this.
    I'm sure x00 or Tim or Lincoln would know.

    I'll post a new plugin if I get this working.

    forgive the bump - this is my 500th comment

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • try to find the core code which handles the form... no idea what controller/view you are talking about from the description.

    You may be able to override or extend the controller via plugin and use some logic to assess what the intent is. Probably just easier to add two new functions: Add and Delete. that way you are explicit. accidentally deleting a row from the DB sux.

  • peregrineperegrine MVP
    edited May 2012

    thx @hbf. I looked at the core and got lost in the woods of /library/core/class.form.php.

    thought maybe i was missing something or maybe it could be modded on a future release if it didn't exist (at least the insert portion).

    I think I will just add the functions as you say. I'm not up to speed or prepared to take on a controller override just yet!

    I'll give it some time before I accept, just so it doesn't get passed over, and if no other responses yours will be accepted. you got a like anyway.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • x00x00 MVP
    Answer ✓

    this is handled in the post back, I would search for plugin that save config options and other things. It doesn't necessary follow a present schema. You validate, and insert wherever.

    grep is your friend.

  • peregrineperegrine MVP
    edited May 2012

    x00 thanks.I'll check more w/ post back- that was part of my inability to grok.

    hbf - I wanted to accept your answer too - because it looks like I'll have to do that anyway, but I now realize that if you reject an answer (too get rid of annoying growler)
    there is no longer an accept or reject by that message.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrine said:
    x00 thanks.I'll check more w/ post back- that was part of my inability to grok.

    hbf - I wanted to accept your answer too - because it looks like I'll have to do that anyway, but I now realize that if you reject an answer (too get rid of annoying growler)
    there is no longer an accept or reject by that message.

    that's ok, i dont really tie my ego to closely to accepted/rejected answers on the interwebz. Hope to get a really sweet wiki article on this one though...

  • hbf said:

    Hope to get a really sweet wiki article on this one though... >

    Yes, if x00 wrote it, I might be able to do figure the whole medley of form functions out. :)

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrine said:

    hbf said:

    Hope to get a really sweet wiki article on this one though... >

    Yes, if x00 wrote it, I might be able to do figure the whole medley of form functions out. :)

    i'd like to see your put on the topic. you'll get it figured out.

Sign In or Register to comment.