Try our conversational search powered by Generative AI!

Can I debug Xforms save button


We've got a problem with our xforms. Nothing is saved to the database and the page you are supposed to forwarded to after replying to the questions doesn't show. Is there a way to debug the save button in the xforms so that I can find out what's wrong?

Apr 08, 2011 6:42

I don't know about debugging the button itself, but you can attach to a number of events like BeforeSubmitPostedData and see if they get hit at all.

A mistake i saw once was that in the BeforeSubmitPostedData there was a condition that could mean that sometimes a Response.Redirect was performed. That ends the request, so the for the client I was helping with this problem it appeared as the posted data was lost at random (when the condition was fulfilled and the redirect performed).

If the ChannelOptions don't include database you won't get it saved either. So if it is not set on the form it won't save to database. Or if you change the options in an event handler it won't get saved.

Apr 08, 2011 7:26

We've never had any event in BeforeSubmitPostedData so tried adding an event to by FormControl.BeforeSubmitPostedData += new SaveFormDataEventHandler(FormControl_BeforeSubmitPostedData); and put string test = ""; inside of it and marked it with a breakpoint. Nothing happened. That's bad, right? ;)

These ChannelOptions you mention, what are they? I can't seem to find them.

I also tried the e-mail response instead of saving to database and nothing happened.

Apr 08, 2011 7:52

When you define the XForm in edit mode you set whether it should send email, save do DB or both. In the events (like BeforeSubmitPostedData) the eventargs contain the ChannelOption somwhere. That is often used if you send custom emails so you can remove the email option from channel optionns to avoid duplicate mails.

If not even the before event is hit I don't know what might be wrong. Do you have any global XForms events defined in Global.asax or an InitalizableModule for example?

Apr 08, 2011 8:02

There are some events in Global.asax but they have been there the whole time. They came with the public templates which the site is built from. For example there is this:

public void XForm_BeforeSubmitPostedData(object sender, SaveFormDataEventArgs e)
    XFormControl control = (XFormControl)sender;

    PageBase currentPage = control.Page as PageBase;

    if (currentPage == null)

    //We set the current page that the form has been posted from
    //This might differ from the actual page that the form property exists on.
    e.FormData.PageGuid = currentPage.CurrentPage.PageGuid;

I'm afraid it's the same thing, even with a break point inside of it nothing happens when the xform is saved. I'm starting to think that this has something to do with our messed up handlers in web.config. Some parts of the edit mode has stopped functioning after we implemented Ajax. Search, My settings, Report center, etc. We've got some Xforms still working though so I don't think they're connected.

Apr 08, 2011 8:18

I found what was wrong. We had two xforms on the same page, one in the right side column with a simple poll. Turns out that's a big no-no!

Problem solved!

Apr 12, 2011 13:57

Ah... If you need multiple xforms, try varying the ValidationGroup as suggested here:

Apr 12, 2011 13:59

I'll keep that in mind. Thanks for the tip!

Apr 12, 2011 14:01
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.