The MODx user profile contains fields for “Date of birth” and “Gender” using a form date input type and form select box. How can we get the Login UpdateProfile snippet to prefill form inputs types for date or select boxes? I discovered the proper place holders for regular display, but couldn’t figure out how to get them to prefill their corresponding form fields.
Date of Birth placeholder: [[+dob]] and needs to be displayed with [[+dob:date=`%D`]]
Attempted both of the above placeholders in the following input field, but neither will prefill.
Gender placeholder: [[+gender]] which is saved as a single number so needs [[+gender:select=`0=Prefer Not To Say&1=Male&2=Female&3=Other`]] in the final output.
I setup the following select box but couldn’t figure out what to do with the placeholder.
One other thing I’ve noticed, if anyone knows, is the stock forms for the EditProfile use things like [[!%login.fullname]] to insert the Full Name or Email label. Where are those stored? Where is it pulling the names from?
It doesn’t do this for [[!%login.dob]] or [[!%login.gender]] and it has a few other quirks like changing [[!%login.mobilephone]] into Cellphone despite the MODx manager page calling it Mobile phone number. So it must not be pulling the extended name from the manager.
MODX tags with a % ([[%...]]) are lexicon tags.
They are located in files. In this case it’s core/components/login/lexicon/en/updateprofile.inc.php (for the english language → .../en/...).
To change a value, don’t change it directly in the file. Go to → “Lexicons” in the manager, choose the correct values for “Namespace”, “Topic” and “Language” (in this case “login”, “updateprofile” and “en”) and edit it.
Lexicon strings are only useful if you have a multi-language site. If your whole site is in english, just hard-code the values directly in the form instead of using lexicon tags.
This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.