One possible way in theory would be to update your login control so that when they login you put into session some of these fields like name with key that corresponds to contour field name then on the contour form for default values you could pick up those values from session, [%name] something like that in default field will pick up value from session? I would check the documentation, I have dont it with setting default values with querystring parameters.
Another way potentially relates to something I recently recently with contour form where i needed to have some additional validation on a registration form built by contour I needed the following:
Password to be entered twice to ensure correctly entered
Email entered twice to ensure correctly entered
Email need to be checked that it was not already in use
Password as greater than 7 chars with 2 numeric
I could have put it together with some custom datatypes for contour but i did it another way which you could use to solve your issue. I created a macro with was server control that looked like
/// <summary>
/// servercontrol macro to inject in richer field validation for contour
/// forms, contour only handles mandatory or regex
This does the following OnInit I get the label for email control and from that get the associated textbox email and assign a new validator to it, i do similar for attaching other validators, so you could in a similar server control check if member is logged in get their profile and fields then find the fields on the form and set the values.
The lookup code looks like
/// <summary>
/// get find control method using generics
/// </summary>
/// <typeparam name="T">type of item you want</typeparam>
/// <param name="ancestor">parent to start looking from</param>
/// <returns>collection of T items</returns>
public static List<T> ControlsByTypeUsingAncestor<T>(Control ancestor) where T : Control
{
var controls = new List<T>();
//Append to search results if we match the type
if (typeof (T).IsAssignableFrom(ancestor.GetType()))
{
controls.Add((T) ancestor);
}
//Recurse into child controls
foreach (Control ctrl in ancestor.Controls)
{
controls.AddRange(ControlsByTypeUsingAncestor<T>(ctrl));
}
return controls;
}
its basically a recursive findcontrol method so in theory you could do something similar.
Using data from current logged in member to prefill fields in form?
Hi,
I'd looking for a way to include member properties as pre-entered text in a contour form (stuff such as name etc)
anonymous users would complete the entire form, members would only need to enter the information we don't have yet.
can this be done?
Rik,
One possible way in theory would be to update your login control so that when they login you put into session some of these fields like name with key that corresponds to contour field name then on the contour form for default values you could pick up those values from session, [%name] something like that in default field will pick up value from session? I would check the documentation, I have dont it with setting default values with querystring parameters.
Another way potentially relates to something I recently recently with contour form where i needed to have some additional validation on a registration form built by contour I needed the following:
This does the following OnInit I get the label for email control and from that get the associated textbox email and assign a new validator to it, i do similar for attaching other validators, so you could in a similar server control check if member is logged in get their profile and fields then find the fields on the form and set the values.
The lookup code looks like
its basically a recursive findcontrol method so in theory you could do something similar.
Regards
Ismail
Comment author was deleted
We'll add support for that in the next release so you could do something like setting the default value to {member.propertyName}
But for now the session workaround should be the easiest
Hi everyone,
Does anyone know if I can use Tim's solution already?
Cheers,
Bas
is working on a reply...