1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Question about AutoValidation and Posting data

Discussion in 'XenForo Development Discussions' started by Uniphix, Oct 20, 2011.

  1. Uniphix

    Uniphix Active Member

    I have a system where I have something like:


    I keep getting errors like this The field 'member.email' was not recognised.

    I would like to know how I can do this and do it right. The thing is that fields.name is from one DataWriter where the other two are from another two data writers. I also have some fields that are NOT part of the datawriter and are handled prior before saving such as total members and the amount which is calclated right before its saved... Well it doesn't have a field name The field 'cost_per_member' was not recognised.

    Any idea on how I can do this?
  2. Brogan

    Brogan XenForo Moderator Staff Member

  3. Uniphix

    Uniphix Active Member

    I am using Beta 3, but this has nothing to do with 'custom fields' this is fields that i am using for a different system :) I can start a conversation if need to be since some of this is private related.
  4. James

    James Well-Known Member

    Have you added the fields to the _getFields function in the DataWriter?
  5. Uniphix

    Uniphix Active Member

    the question i have is does those fields get write to sql? because some of those fields are not database based...
  6. Uniphix

    Uniphix Active Member

    Here is a good example of the situtation I am having.

    You see I have "Trip" and "Trip Locations"

    Now a Trip Location has it's own DataWriter, and Trip has it's own as well, but the problem is I want to be able to validate one trip location which is added prior to creation of the first trip. Then when created they can add more trips... Now there may be a chance where I want multiple trips added at the time of creating a trip. Now I am not sure how about to do this...

    I've noticed that in User there are many different list of xf_user stuff but those seem to be linked to each other and is required...

    So how would I go about doing this for multiple locations and validating them???
  7. xfrocks

    xfrocks Well-Known Member

    If your field is not in database, you should opt out it from AutoValidation.
    If you still want to validate it somehow (check for locations before trip etc), you will need to do it in the DataWriter using _preSave(). You can throw an exception and user will see that as an error message.

    Hope this helps.
    Uniphix likes this.
  8. Uniphix

    Uniphix Active Member


Share This Page