Composite.Forms.Renderer custom validation & value from query string

Topics: General, Standard packages
Dec 14, 2010 at 4:23 AM

I have implemented a feedback form using Composite.Forms.Renderer and would like to enhance it with two things:-

1. Have a Confirm Email field whose validation is to ensure it contains the same value as the Email field.  Do I need to write some custom validation code?  If so, where and how?

2. Have a select list which has it's options drawn from a global datatype to have a pre-selected value based on a query string parameter.

I have looked at the documentation but can't see how to do either of these.  Any help will be greatly appreciated.

Coordinator
Dec 14, 2010 at 8:19 AM

The Forms renderer don't have support for a confirm e-mail field, sorry. You could probably tweak it in there, but my guess you would be better of just writing a ASP.NET User Control with the form/e-mail handling.

On point 2 you might be able to achieve the desired result by editing your type, setting a default value for the field and use the appropriate Composite.Web.Request.QueryStringValue function - I haven't tried though.

 

Dec 14, 2010 at 8:26 AM

Thanks Mawtex.

Aug 29, 2011 at 7:09 PM

Hi All,

I genereated form to enter data using Composite.Forms.Renderer.

Now the form uses 1/2 of the page. How can i change size of the form?

Also can i change size of the left part of the form (wjth labels, to make sizes of left and right parts different?

 

Aug 29, 2011 at 7:13 PM

Hi All,

Next question about Composite.Forms.Renderer.

Can button 'Submit' be changed to other button - 'Buy Now' for example?

And then save data after payment?

Thanks!

 

Coordinator
Aug 29, 2011 at 7:20 PM

See http://docs.composite.net/Composite.Forms.Renderer for details. There is a reference to a style sheet, which should enable you to tweak the look and feel of the forms.

If you edit the C1 Function call to Composite.Forms.Renderer you embedded on your page, you should be able to override what text is used in the submit button. But making this feature dependent on a payment is not an available feature.

Aug 30, 2011 at 1:34 PM
Edited Aug 30, 2011 at 1:36 PM

mawtex,

thank you for reply!

About the button - I see- i can change button caption.

I asked about something else - can i change Submit button code to my button code? I need to add payment functionality and i have needed html code for the button.

May be it is possible in Visual Studio?

Thanks!

Coordinator
Aug 30, 2011 at 1:45 PM

>>I asked about something else - can i change Submit button code to my button code? I need to add payment functionality and i have needed html code for the button.

>>May be it is possible in Visual Studio?

No, it is impossible in Composite.Forms.Renderer, it is better to write your own ASP.NET User Control with form so you can handle what you need.

Aug 30, 2011 at 1:53 PM

mawtex,

one more question.

can i change error message - when fields are entered incorrect?

Now it is so long and shows all rules.

Thanks!

Coordinator
Aug 30, 2011 at 1:58 PM

Yes, if you write help texts for the fields, they will be used instead of the geeky validation messages.

Aug 30, 2011 at 2:19 PM

Inna, mawtex, thank you a lot :)

Aug 31, 2011 at 12:20 PM
Edited Aug 31, 2011 at 12:35 PM

Hi All,

As i uderstood when button 'Submit' is clicked data should be saved in xml-format. Am i right?

Where can i find the file with saved data?

Can i use rendered form to save data in SQL server db?

And how can i see Composite.Forms.Render function code?

Thanks!

Aug 31, 2011 at 5:01 PM

I entered data into the rendered form, click 'Submit' button, see the succesfull message.

But i cannot find saved data.

What can be wrong? Where can i see the data?

Developer
Sep 1, 2011 at 6:33 AM
Edited Sep 1, 2011 at 6:34 AM

Hi Olga,

olga_titova wrote:

I entered data into the rendered form, click 'Submit' button, see the succesfull message.

But i cannot find saved data.

What can be wrong? Where can i see the data?

 Composite.Forms.Renderer is always based on a certain data type, which you select when you add the function on a page.

So you can see the submitted data in the Data perpspective in the data type you specified.

(Physically, it is stored in a corresponding XML file on an XML-based website or a corresponding table in a database on an SQL-based website. But actually, you don't need to know it :) because you can do all the necessary operations with the submitted data in the Administrative console - in a user-friendly way.)

I would recommend reading the chapter "Using input forms with data types" in our guide on data types. Plus, you can read on Composite.Forms.Renderer here: http://docs.composite.net/Composite.Forms.Renderer

/Vitaly

Sep 2, 2011 at 6:30 PM

Vitaly,

Thank you for reply :)

One more question about rendered form.

I need some info below the form on the page. The info should be invisible or disabled until data in the rendered form is submited.

Then after data saving i need to enabe (or make visible) the info (i think it can be placeholder).

Can i have the functionality without creating new user control?

Thank you!

 

Sep 2, 2011 at 7:13 PM

Hi All,

Can i add validation rule for checkbox?

I want to save data only when the checkbox is checked.

Is it possible?

Thanks.

Sep 2, 2011 at 8:09 PM

Hi Olga, you may want to consider adding a checkbox with some basic javascript that sets the submit button to "enabled" when you click the checkbox. It will probably work for 99% of people.

See an example of how to do this here: http://jvance.com/blog/2009/07/14/GetValueOfCheckboxUsingJQueryToEnableButton.xhtml

You can do this with basic javascript, but if you're already loading jQuery, it's easier.