Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > Bizforms - Dropdown SQL Query vs UI-Culture View modes: 
User avatar
Member
Member
Christian Stampfli - 9/28/2009 8:40:51 AM
   
Bizforms - Dropdown SQL Query vs UI-Culture
Hi there

I'm trying to build a bizform with some dropdowns using SQL queries.
In one case I have to give the current ui-culture to the database.

c# and macro expressions don't work - is there *any* way to give the ui culture to the database?

Thanks & Regards
Christian

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 9/29/2009 7:06:34 AM
   
RE:Bizforms - Dropdown SQL Query vs UI-Culture
Hi Christian,

could you please confirm me that I get your point?

You would like to save the current culture of visitor to one of BizForm fields (it may be hidden). Is it right?

Best regards,
Helena Grulichova

User avatar
Member
Member
Christian Stampfli - 9/30/2009 2:46:52 AM
   
RE:Bizforms - Dropdown SQL Query vs UI-Culture
Hi Helena

No, that's not what I want to do.

I want to put a dropdown into a bizform which gets the data from an sql-query and not from a "hardcoded source" (value;name etc). But to get the correct values for the dropdown I have to submit the current ui-culture to the database.

The sql which gets the data for the dropdown would look like this:

SELECT value, name
FROM tbl_Example
WHERE UI_Culture = [ui-culture-from-current-visitor]

Is this possible with V4?

Regards
Christian

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 9/30/2009 3:57:14 PM
   
RE:Bizforms - Dropdown SQL Query vs UI-Culture
Hi Christian,

thank you for your explanation.

You may use a context macro inside the SQL query.

I tested the query like:

Select UserName, UserName from CMS_User where PreferredUICultureCode like '{%cmscontext.currentdocument.documentculture%}'

and it works perfectly.

More information about macros is here: http://devnet.kentico.com/docs/devguide/appendix_a___macro_expressions.htm



Best regards,
Helena Grulichova

User avatar
Member
Member
Christian Stampfli - 10/9/2009 9:39:49 AM
   
RE:Bizforms - Dropdown SQL Query vs UI-Culture
Hey Helena

Thank you very much - that worked perfectly.

Another follow-up question (same bizform, different problem):

I want to put 3 upload-fields into the bizform. The first field is required in every case - for the second and third field there must be minimum one upload. If there are uploads in both (second+third) fields it's ok - but if there's only a upload in the first field but no uploads in second + third field I want to display an error.

Is there an easy way to do this with kentico own features or must we go deep into the code? =)

Best regards
Christian

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 10/12/2009 3:43:13 AM
   
RE:Bizforms - Dropdown SQL Query vs UI-Culture
Hi Christian,

regrettably, you may not ensure this behavior in the web interface. You have two possibilities how to achieve your goals:

1.
You could develop a custom form control (http://devnet.kentico.com/docs/devguide/developing_form_controls.htm) with two upload fields inside. You may add the validation according your needs in the code behind and save the content (files) programmatically.

2.
You could modify the BizForm web part (http://devnet.kentico.com/docs/devguide/modifying_the_code_of_standard_web_parts.htm) and check your custom file upload fields in the OnBeforeSave() event. You stop the BizForm processing (saving data) by:

this.StopProcessing = true;

Best regards,
Helena Grulichova

User avatar
Member
Member
Christian Stampfli - 10/12/2009 7:25:06 AM
   
RE:Bizforms - Dropdown SQL Query vs UI-Culture
Hi Helena

That are the two things we talked about here too - thank you for confirming there is no way built-in directly =)

Regards
Christian