Copied to clipboard

Flag this post as spam?

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


  • Neil Hodges 338 posts 987 karma points
    Jan 31, 2013 @ 15:34
    Neil Hodges
    0

    Multistep Application Form using Usercontrols and getting Mmebership details

    Hi

    I need to create a multi step application form in my site. Im using Umbraco 4.11.3

    I have Contour and while this will do a good job with what i want to do im unsure if i can do some things which are needed and may be out of the scope of what Contour can do.

    My application form consists of around 9 steps. On the 9th Step it saves the fact that application has now been sumbitted and the user cannot reapply said application, i need to show a box just stating that they have completed the application as they got to step 9 and sumbitted the form.

    The 1st page of the application form is to show the Members details they have inputted when they have logged inn. I can do this ok in Contour but whish to do it in a usercontrol, add a macro and insert onto a page.

    The reason being the user can complete upto 8 steps before completing the application, so therefore if they complete up to say step 5 and come back to it a later date i need to be able to populate the information where they have got up to. Then they can carry on to step 9 and then submit the form.

    Once step 9 is complete they cant come back to it.

    So therefore seen as its quite complex i need to do this within a usercontrol with custom code and custom tables to store data, which is fine i think i can do that, the bit im stuck on is accessing a logged in member.

    Some sample code to access the logged in member?, is there a sessionid i can grab to get the member populate an object? then i can output the info into the form.

    Any help would be greatly apreciated

    Kind Regards

    Neil.

  • Nigel Wilson 945 posts 2077 karma points
    Jan 31, 2013 @ 19:05
    Nigel Wilson
    0

    Hi Neil

    If you are using the standard Umbraco membership functionality you can access the logged in member via the following

    Member currentMember = Member.GetCurrentMember();

    Then if you are saving the member data within Umbraco you can use the following to retrieve the saved value.

    currentMember.getProperty("firstName").Value 

    However you state you want to use custom tables for data, so am not sure if the above is what you were wanting.

    Cheers, Nigel

  • Neil Hodges 338 posts 987 karma points
    Jan 31, 2013 @ 19:15
    Neil Hodges
    0

    Hi Nigel

    Thanks for the quick response.

    Ive have the currentMember.getProperty("firstName").Value but im having trouble getting my drop down values.

    I can get is ID but cant get to the textual value, is there a way to

    a)get the text value of the drop down

    b)get all the text and values of that drop down so i can rebind to a drop down control?

    This is so if the user wants to update their city for instance they can select from the drop down which is populate from the custom property which i set in the membership section.

    Cheers

    Neil.

     

  • Nigel Wilson 945 posts 2077 karma points
    Jan 31, 2013 @ 19:40
    Nigel Wilson
    0

    Hi Neil

    Sorry but you will need to provide a bit more information around where/how you are storing the dropdown details ? Is is a custom datatype. Is it content nodes that you are outputting ?

    Then a code sample of what you have tried so far would also be useful - show the code that you have used to get the ID and maybe from that a solution might be able to be provided for you, or have some ideas to get you moving forward with your work.  :-)

    Cheers, Nigel

  • Neil Hodges 338 posts 987 karma points
    Jan 31, 2013 @ 19:52
    Neil Hodges
    0

    Hi Nigel

    I think i may have something near now, my code is:

    //GetLogged in Member
                var umbMem = Member.GetCurrentMember();

                var psswrd = umbMem.Password;
                var lgname = umbMem.LoginName;

                const int dataTypeId = 1179; <----------- Wonder if i can get this ID dynamically instead of hard coding
                int dropDownId = Convert.ToInt32(umbMem.getProperty("membertitle").Value);
                string dropDownText = string.Empty;

                SortedList preValues = PreValues.GetPreValues(dataTypeId);
                PreValue preValue = preValues.Values.Cast<PreValue>().FirstOrDefault(x => x.Id == dropDownId);

                var Title = preValue;
                var Name = umbMem.getProperty("membername").Value.ToString();
                var TwitterID = umbMem.getProperty("memberTwitterID").Value.ToString();
                var FacebookID = umbMem.getProperty("facebookID").Value.ToString();
                var Position = umbMem.getProperty("position").Value.ToString();
                var Organisation = umbMem.getProperty("organisation").Value.ToString();
                var PrimarySector = umbMem.getProperty("primarySectorOrActivity").Value.ToString();
                var AddressLine1 = umbMem.getProperty("addressLine1").Value.ToString();
                var AddressLine2 = umbMem.getProperty("addressLine2").Value.ToString();
                var TownCity = umbMem.getProperty("towncity").Value.ToString();
                var County = umbMem.getProperty("county").Value.ToString();
                var postcode = umbMem.getProperty("postcode").Value.ToString();
                var Phone = umbMem.getProperty("phone").Value.ToString();
                var Subscribe = umbMem.getProperty("subscribeToOurMailingList").Value.ToString();

     

    the Title is a custom property in the Membership properties. Its a drop down with 3 values, Mr, Mrs, Miss

    I think now i have the prevalue i can loop through the SortedList preValues and populate a drop down in the usercontrol.

    My only wonder is how i get the const int dataTypeId dynamically.

  • Nigel Wilson 945 posts 2077 karma points
    Feb 01, 2013 @ 00:27
    Nigel Wilson
    100

    Hi Neil

    One option is to add the ID within the appSeettings section of your web.config file

    <add key="memberTitleDataTypeID" value="1179" />

    Then in your code reference the setting in your code via 

    System.Configuration.ConfigurationManager.AppSettings["memberTitleDataTypeID"]

    Hope this helps - I am sure there are other options.

    Cheers, Nigel

  • Neil Hodges 338 posts 987 karma points
    Feb 01, 2013 @ 12:02
    Neil Hodges
    0

    Hi Nigel

    Thanks, yep i shall do that for now, seems a fair enough fix, i'll refactor at a later date should i find another option.

    Thank you for your help, much apreciated ;)

    Niel.

Please Sign in or register to post replies

Write your reply to:

Draft