Developer forum

Forum » Dynamicweb 10 » How to use custom user fields in Sign up form

How to use custom user fields in Sign up form

Joseph Vause
Reply

Hello,

How can you use custom fields in a customer sign up form?

We have type called RecommendationCode with Field Type Text, but we cant seem to get the name of the custom field to set on the input in the form, so it never gets set.

@GetValue("UserManagement:User.RecommendationCode.InputName")" returns " " "

@GetValue("UserManagement:User.AccessUser_RecommendationCode.InputName")" returns " " "

GetString also doesn't return any value

Thanks

Running on DW 10.6.7


Replies

 
Claus Kølbæk
Claus Kølbæk
Reply

Hey Joseph
Maybe something like this is an option for you?:
var recommendationCode = Pageview.User.CustomFieldValues.Where(x => x.CustomField.SystemName == "RecommendationCode").FirstOrDefault()?.Value;

Or is it because you need to save into the custom field?

 
Joseph Vause
Reply

Hi Claus,

Thanks for the response, yes we need to save the value in the sign up form, but we cant seem to get the name / ID of the custom field so its saved on form submit.

Thanks

 
Joseph Vause
Reply

I have found them (after printing out the entire Values collection)

@GetValue("UserManagement:User.CustomField.AccessUser_RecommendationCode.Input.ID")

Is there a chance that the documentation be updating for DW10 on how to access Custom Fields using Template Tags?

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Joseph

It seems UserManagement:User.AccessUser_RecommendationCode.InputName does not have a value on the signup form because the field is only editable for existing users. So there is a specific check in the code to not set this tag when not editing an existing user.

I agree that it is a little odd. It could be a security related 'feature'. But glad you found a way around it.

On a side note I can mention that everything for user management frontend is currently being re-writte to new modules with viewmodels and separated into 6-7 specific modules for login, create user, addresses etc.

BR Nicolai

 

You must be logged in to post in the forum