Developer forum

Forum » Development » FormSave Provider

FormSave Provider

José Silva
Reply
Hello!

I'm creating my custom FormSave Provider and everything looks ok, the problems are when the form is finished and send a Template.

        private void PrintTags(string TextToPrint, MsgType TextType)
        {
            Dynamicweb.Templatev2.Template template = new Dynamicweb.Templatev2.Template(Template);
            switch (TextType)
            {
                case MsgType.Error:
                    template.SetTag("Registration.Error.Description", TextToPrint);
                    break;
                case MsgType.OK:
                    template.SetTag("Registration.OK.Description", TextToPrint);
                    break;
            }
            HttpContext.Current.Response.Write(template.Output());
        }

I'm sending a template with the necessary tags, but nothing happens.

Another problem is the return answer for the method "Save" inside of the FormSave Provider, even returning False the form is saved.

I found this code in other FormSave Provider for return the web site when something is wrong:

HttpContext.Current.Response.Write(String.Format("<script>alert('Email address: \'{0}\' is invalid.');history.back(-1);</script>", mailAddress))

Is this the only way to go back? using javascript.


Thank you!

Replies

 
Marco Santos
Reply

I also am looking for a way to cancel the form save in a way that would stop the record from being created in the database. Is there a way to achieve this? If not, is there a way in that the formsave provider or subscriber would be able to get the id of the newly created record so that we could delete it?

 
Mikkel Høst
Reply
This post has been marked as an answer
I tryed this before and i had the same problems. I ended up using a unique id in the form, like the users id, and then check for that ID in the database and delete it. Hacky, but it works :)
Votes for this answer: 1

 

You must be logged in to post in the forum