Developer forum

Forum » CMS - Standard features » How to use customer user fields

How to use customer user fields

Casper Andersen
Reply

Hello DynamicWeb

I am working on a registration form for a website. atm i am using the standard registration form from the extranet module.

But i have some custom fields i want to add to the form,

a normal field looks like this: GetString("UserManagement:User.Company.Input").Replace("input ", "input class=\"form-control\" style=\"width: 100%\" required=\"required\"")

the way i implemented my custom field: <input class="form-control" style="width: 100%" type="text" required="required" id="@GetString("UserManagement:User.AccessUser_Salutation.Name")" name="@GetString("UserManagement:User.AccessUser_Salutation.Name")" />

not sure if i did that correctly. in my form, when i click to register the new user, the information put inside the custom field is not added to the users account.

 

Regards Casper Andersen


Replies

 
Nicolai Høeg Pedersen
Reply

Does it work with the normal template tag for the input? Take a look at the post using the browsers dev toolbar and compare the data when using your own approach...

 
Casper Andersen
Reply

I looked at the payload and it looks as it should. Image

is there a way to use the @GetString() method on custom fields ?

 
Casper Andersen
Reply

Like this link explains, i can use @GetString("@UserManagement:User.AccessUser_Salutation.Name") and that works fine, but i am very unsure of how to get my register user form to take the information from the 2 new fields and add it to their created account

 

 
Nicolai Høeg Pedersen
Reply

Hi Casper

I am a bit confused about the issue. Can you post a link to the page with the issue - then I'll have someone look into it.

BR Nicolai

 
Casper Andersen
Reply

Yeah that is the only problem, i am running on a copy of our site but on my localhost, so very sorry about that :(

This is 2 sections of the form, the first section is a standard field that works perfectly and the second section is my custom code.

I added the Salutation field in the extranet konfiguration panel. it is of type text has a name of Salutation and a system name of AccessUser_Salutation

 

<div class="col-md-6 col-xs-12">
                                    <div class="form-group">
                                        <label class="control-label">@Translate("Company", "Company"):</label>
                                        <div class="input-group">
                                            <span class="input-group-addon" id="basic-addon1"><i class="fa fa-building"></i></span>
                                            @GetString("UserManagement:User.Company.Input").Replace("input ", "input class=\"form-control\" style=\"width: 100%\" required=\"required\"")
                                        </div>
                                    </div>
                                </div>

 

What i'm trying to do

 

<div class="col-md-6 col-xs-12">
                                    <div class="form-group">
                                        <label class="control-label">@Translate("Salutation", "Salutation"):</label>
                                        <div class="input-group">
                                            <span class="input-group-addon" id="basic-addon1"><i class="fa fa-smile-o"></i></span>
                                            @GetString("@UserManagement:User.AccessUser_Salutation.Input").Replace("input ", "input class=\"form-control\" style=\"width: 100%\" required=\"required\"")
                                            <input class="form-control" style="width: 100%" type="text" required="required" id="UserManagement_Form_AccessUser_@GetString("UserManagement:User.AccessUser_Salutation.Name")" name="UserManagement_Form_AccessUser_@GetString("UserManagement:User.AccessUser_Salutation.Name")" />
                                        </div>
                                    </div>
                                </div>

 

in the last one i try 2 different things

1. @GetString("@UserManagement:User.AccessUser_Salutation.Input").Replace("input ", "input class=\"form-control\" style=\"width: 100%\" required=\"required\"")

which return nothing at all.

2. <input class="form-control" style="width: 100%" type="text" required="required" id="UserManagement_Form_AccessUser_@GetString("UserManagement:User.AccessUser_Salutation.Name")" name="UserManagement_Form_AccessUser_@GetString("UserManagement:User.AccessUser_Salutation.Name")" />

which creates a tag exactley like the standard fields, but the information entered into it is not added to the users created profile.

 

Hope this makes more sense

 
Nicolai Høeg Pedersen
Reply

 

Well, cannot debug without a link. At least the entire template. One quote in the wrong place and it will not work...

You have many weird things going on - strip this field to bare minimum and see if it works. That is using JUST @GetString("UserManagement:User.AccessUser_Salutation.Input")

You have @GetString("@UserManagement:User.AccessUser_Salutation.Input") in your first example, that contains a @ too much...?

 
Casper Andersen
Reply
This post has been marked as an answer

Ok i figured it out :)

we where close.

Original

<input class="form-control" style="width: 100%" type="text" required="required" id="AccessUser_Salutation" name="AccessUser_Salutation" />

The one that works

<input class="form-control" style="width: 100%" type="text" required="required" id="CustomField.AccessUser_AccessUser_Salutation" name="CustomField.AccessUser_AccessUser_Salutation" />

the name and id needed to be prefixed with CustomField.AccessUser_

Thanks a lot for the help

Votes for this answer: 1

 

You must be logged in to post in the forum