I am trying to create a field type to test, using contour. The aim is to add this as a FieldType and then on the Rendered form in preview mode i enter a name and it displays it in a label. So i have a class
public class TestField : FieldType
{
public TestField()
{
Id = new Guid("B77F6BA7-2BD0-43B8-9A5E-AA408C559945");
Name = "Test";
Description = "Just a test";
DataType = FieldDataType.LongString;
}
public override string RenderPreview()
{
//Code to display the field in contour
}
public override List<object> ProcessValue(HttpContextBase httpContext)
{
//var v = new List<object>();
// Some code to run and show the name entered
}
}
The cshtml is plain and simple
I see Test as a FieldType and select it, the control displays as i would expect. I then view the form in preview mode - all controls are displayed correctly. When i click the button (this is the button which is part of the control i created) it doesnt do anything. I enter into debug mode and notice all events are fired but i cant seem to get to the click event of this button using the above C# code?
No razor macro as far as i know? the complete code i have in my class is above (so with you asking i already think im doing something wrong or have missed something?). The code in the cshtml is
<div class="somClass">
<input type="text" name ="Name" value="@Request["Name"]" id="Name"/>
<input type="button" value="Your name is" name="CustomerName" id="BtnCustomerName" />
<label for="ReturnValue"> </label>
</div>
All im trying to do is create a test fieldtype to see how it works (a basic example) before i create my own with a bit more complexity to it.
So for this example all i want to do is go into contour > create a form > select my custom field type which is a textbox button and label > preview the form which displays the control (textbox, button and label). Type "hello world" in the textbox, click the button and hello world is displayed in the label. Thanks
Fieldtype click event
I am trying to create a field type to test, using contour. The aim is to add this as a FieldType and then on the Rendered form in preview mode i enter a name and it displays it in a label. So i have a class
The cshtml is plain and simple
I see Test as a FieldType and select it, the control displays as i would expect. I then view the form in preview mode - all controls are displayed correctly. When i click the button (this is the button which is part of the control i created) it doesnt do anything. I enter into debug mode and notice all events are fired but i cant seem to get to the click event of this button using the above C# code?
So no one knows if the above is wrong/right?
Comment author was deleted
Hey,
are you using the razor macro? THen it doesn't use the webcontrol so no click event, mind sharing the complete code and what you are trying to do?
No razor macro as far as i know? the complete code i have in my class is above (so with you asking i already think im doing something wrong or have missed something?). The code in the cshtml is
All im trying to do is create a test fieldtype to see how it works (a basic example) before i create my own with a bit more complexity to it.
So for this example all i want to do is go into contour > create a form > select my custom field type which is a textbox button and label > preview the form which displays the control (textbox, button and label). Type "hello world" in the textbox, click the button and hello world is displayed in the label. Thanks
is working on a reply...