I'm working on extending contour forms for iPad. My goal for the moment is to render an input text field that will render as "<input type="email" ..... " so that this will render as a field to enter an email address.
Here's my first try of extending contour ....
namespace Foodstuffs.Umbraco.NewWorldKiosk.contourControls
{
public class TextfieldEmail : FieldType
{
public System.Web.UI.WebControls.TextBox tb;
public List<Object> _value;
public TextfieldEmail()
{
this.Id = new Guid("74d7dfda-dac5-4e29-8eb6-9843a98f8794");
this.Name = "iPad Email Field";
this.Description = "Renders a html5 email input";
this.Icon = "textfield.png";
this.DataType = FieldDataType.String;
tb = new TextBox(); _value = new List<object>();
}
public override WebControl Editor
{
get {
tb.TextMode = System.Web.UI.WebControls.TextBoxMode.SingleLine;
tb.CssClass = "email";
return tb;
}
set { base.Editor = value; }
}
public override List<Object> Values
{
get{ if (tb.Text != "") { _value.Clear(); _value.Add(tb.Text); } return _value; }
set{ _value = value; }
}
public override string RenderPreview() { return "<input type=\"email\" class=\"text\" />"; }
public override string RenderPreviewWithPrevalues(List<object> prevalues) { return RenderPreview(); }
public override bool SupportsRegex { get { return true; } }
}
}
I tried changing the value for RenderPreview() from
"<input type=\"text\" class=\"text\" />"
to
"<input type=\"email\" class=\"text\" />"
but I ended up having another <input type="text" .....
I think the renderpreview method is just used by the Contour UI to render the field in the forms editor UI. If you look at the source there, is it showing up as type="email"?
I believe that the part you need to change for what gets rendered in the actual for is the part for "public override WebControl Editor".
You need to update that part to return an ermail field. You may need to use a HtmlInputText control instead of a textbox, as that should alow you to set the type to "email".
Custom Contour Fields
Hi Guys,
I'm working on extending contour forms for iPad. My goal for the moment is to render an input text field that will render as "<input type="email" ..... " so that this will render as a field to enter an email address.
Here's my first try of extending contour ....
I tried changing the value for RenderPreview() from
"<input type=\"text\" class=\"text\" />"
to
but I ended up having another <input type="text" .....
can someone enlighten me on this one, please?
Thanks
Hi Bobby,
I think the renderpreview method is just used by the Contour UI to render the field in the forms editor UI. If you look at the source there, is it showing up as type="email"?
I believe that the part you need to change for what gets rendered in the actual for is the part for "public override WebControl Editor".
You need to update that part to return an ermail field. You may need to use a HtmlInputText control instead of a textbox, as that should alow you to set the type to "email".
Hope that helps!
:)
is working on a reply...