Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Denford 132 posts 323 karma points
    Dec 22, 2011 @ 16:50
    Denford
    0

    Pre-populate a contour form with values from a asp.net control form

    hi guys,

    i want to know if its possible to automatically fill in contour's fields from another data source. Basically we have a third party control form that gets its values from the third party's system which stores users information and i would like either:

    a) get the values on a asp.net control form then automatically map the fields onto my contour form and save the form or save them directly as entries in the backend of contour

    b)create a small contour form that send two fields ( e.g. surname and user ID) to a third party data storage, which would check if the details match any records and if so bring back the data to a second form which will be pre-filled with these details and gets saved into contour when the user submits the form.

    so either way i would need contour to map/save these entires so that i can use all the contour options e.g. send emails and also allow my client to use these entries for their competition they are running as well as other marketing stuff they need to do and am stuck at the moments looks like all the posts/packages are to get information out not in. PLEASE HELP IF YOU KNOW HOW OR IF ITS EVEN POSSIBLE LOL.

    Denford

  • mouseball 63 posts 70 karma points
    Jul 31, 2013 @ 08:46
    mouseball
    0

    I know this is an old post ... but I wondered if anybody ever had an answer for this

  • Denford 132 posts 323 karma points
    Jul 31, 2013 @ 23:02
    Denford
    0

    Ye never got a decent answer (or any for that matter lol) what i ended up doing i think was create a datasource in contour get my user control to add the data to the database table linked to the datasource and use the data source on the form, unfotunately its a while ago now dont even have the code i used but that was my work around im sure. good luck lol.

  • Vasia Vasia 49 posts 241 karma points
    Nov 05, 2013 @ 14:00
    Vasia Vasia
    1

    you should use the DefaultValue of field and put there  [@requestValueKey]

  • Comment author was deleted

    Nov 06, 2013 @ 08:42

    Yup or populate a session variable and use [%sessionKey] as the default value

  • Denford 132 posts 323 karma points
    Nov 06, 2013 @ 10:35
    Denford
    0

    thanks guys will have to try these options, am sure will come up with this situation again.

  • Mark 255 posts 612 karma points
    Aug 19, 2014 @ 13:42
    Mark
    0

    Is there a way to do this in Contour 3.x? E.g. via the "code first" method? Or are the above options still the only ones? I need to be able to fill a form with member details, but we use a custom membership provider, not the built in umbraco member provider, so can't use member.x syntax. The form is build using the "code first" method, so I'm hoping there is something I can do there

  • Denford 132 posts 323 karma points
    Aug 20, 2014 @ 07:38
    Denford
    0

    Yes this should be possible, i have sort of done something similar where im my code first class i get some details from the current logged in member and save these as default values for some hidden inputs i need to be in the form vaules, as well as have some custom logic to update that accont after they submit the form.

  • Mark 255 posts 612 karma points
    Aug 20, 2014 @ 10:21
    Mark
    0

    Thanks @denford. Do you mean you put the initialisation code inside the constructor? Can you show any code for this? I'm just wondering how we can distinguish between an initial form load and a subsequent submission, I suppose I can check the HttpContext.Current.Request.HttpMethod for POST in my case.

  • Mark 255 posts 612 karma points
    Aug 20, 2014 @ 11:24
    Mark
    0

    Looks like the constructor is called when the application starts, not when the form is rendered. Is there no simple way to initialise form fields through code using code first?

  • Denford 132 posts 323 karma points
    Aug 20, 2014 @ 13:12
    Denford
    0

    I am not sure, i know you can add default values to your fields in my case am getting the name and email addresses from their account into the form and this will get it if the user is logged in like so:

    DefaultValue = "{member.name}"

    I guess in your case your need to get these details from your custom membership provide, so suppose you could either have your class, model to get these details and add them as default valus ( bat as you mentioned this runs when the application starts so the data will need to be there then) otherwise i would just use the umbraco membership, export your members in from your custome provider, then you can just use the above syntax sorted, after all the new membership API now works hand in hand with the standard .net one .

    see this post here http://www.nibble.be/?p=205 or http://umbraco.com/follow-us/blog-archive/2012/11/6/contour-30-features-code-first.aspx thats the one i use to base my code behind forms from.

     

     

Please Sign in or register to post replies

Write your reply to:

Draft