Variable number of fields in Google Form? - google-forms

Is there a simple way to make a Google Form have a variable number of a fields based on numerical input from a previous field (e.g. asking how many people will be registered and then providing that number of name fields)?
I've tried Googling and looking on Stack Overflow, but couldn't find anything. I'm not really familiar with JavaScript, although I know a small amount of PHP.
Thanks!

Related

Posting variable data

I am building an application in ASP.NET, C#, MVC3 and SQL Server 2008.
A form is presented to a user to fill out (name, email, address, etc). I would like to allow the admin of the application to add extra, dynamic questions to this form.
The amount of extra questions and the type of data returned will vary. For instance, the admin could add 0, 1 or more of the following types of questions:
Have you a full, clean driving liscence?
Rate your drivings skills from 1 to 5.
Describe the last time you went on a long journey?
etc ...
Note, that the answers provided could be binary (Q.1), integer (Q.2) or free text (Q.3).
How would I allow the posting of 0, 1 or more random values from the form back to my code?
Any help would be greatly appriecated.
Thanks in advance.
PS. I asked a similar question regarding the storing of this data in sql, see here
You will need to use an EAV scheme for storage. For a discussion of the topic, along with common pitfalls and solutions, see Best Practices for Semantic Data Modeling for Performance and Scalability. Other alternatives are Sparse Columns and XML data type column, but I think EAV is superior most of the times.
You'll have to accomplish this using dynamic controls.
Basically you'll read the question list from your database, inject zero or more custom controls to emit the question(s) and accept the answer(s). Probably wrapped in a repeater.
On post back you'll have to rehydrate the dynamic controls so that you can get the values.
I have done this before when I worked on a survey tool.
So first of all you need to decide what questions type you'll have. I had SingleOption, MultiOption and FreeText type questions.
User logs into the admin screen and selects a type of question he wants to add. He then clicks on Add button, which submits a request to a controller/web service.
Controller looks at type of question and adds a record into the database.
Rough table structure below:
QuestionID | SurveyId | QuestionTypeId
2 4 1
This is your basic structure.
When you generate an interface for answering questions, you will retrieve all questions with a SurveyId = 4.
You will then write an HTML helper that looks at question type and generates an appropriate control.
When it comes to submitting a survey, or answers to your question, you will display all questions and answer fields in some div, say we call it "survey_questions". Inside this div will be a form which will contain all your questions and controls for answers (text inputs, checkboxes etc).
You will then submit this form through jQuery to a controller/web service. Controller/Web Service will read survey id and it will iterate through all submitted values.
You will then use these values to populate a table for storing survey results. I understand that this is very brief and abstract, but I have worked over a month on this, so if this is useful and you need further help, then please ask.
I found a great article that solves my problem.
You can find it here

Drupal 7: How can I create a key/value field(or field group, if that's even possible)?

Let's say I'm creating some app documentation. In creating a content type for functions, I have a text field for name, a box for a general description, and a couple other basic things. Now I need something for storing arguments to the function. Ideally, I'd like to input these as key-value pairs, or just two related fields, which can then be repeated as many times as needed for the given function. But I can't find any way to accomplish this.
The closest I've gotten is an abandonded field multigroup module that says to wait for CCK3, which hasn't even produced an alpha yet as far as I can tell and whose project page makes no obvious mention of this multi-group functionality. I also checked the CCK issue queue and don't think I saw it in there, either.
Is there a current viable way of doing this I'm not seeing? Viable includes "you're thinking of this the wrong way and do X instead." I've considered using a "Long text and summary" field, but that smells hackish and I don't know if I'd be setting myself up for side-effects. I'm new to Drupal.
There is the http://drupal.org/project/field_collection module but it's not yet ready. Right now you would need to implement your entity alas to do this :( not easy.
Not sure how well it would work, because it currently does a bit more (eg, forces to group pairs into categories and the keys need to be predefined) but you might want to have a look at http://drupal.org/project/properties.
You could create a these key-value fields on their own: create 2 regular fields that that can be added as often as needed.
So you have a x fields for the keys and x for the values. If this is only for you or other people it might work OK but usability wise, it's very ugly.
If you need to extract the fields from the function, to display it properly in a page template, you should propably use a different approach. Write the function with its arguemnts in a CCK field and in the template extract them as needed. The arguments are always (depending on language) in () and the different arguments are seperated by , so splitting them would by pretty easy.

Good way to allow people to select a lot of things?

I'm using jQuery, ASP.NET, SQL Server, and the other usual suspects to design a company CRM. After they put in contact info, notes, dates, places and so forth they have to be able to select many different people to be "CC'ed." A group of people will be required to be one either "CC'ed" or "ToDo." The rest of the people can be nothing or "CC" or "ToDo." Currently we have it set up as a huge databind to templates with radio buttons for each option. Looks like shit. Anyone have any suggestions? I'd like to use a template with a datasource and have a good way to retrieve their answers and use them.
I'm leaning jQuery direction but like I said I'll need there to be up to 3 possible options for the people. This is going to be all opinion so I'm just looking for options.
Just to re-clarify, this concept is similar to email but I don't want them to have to type anything in as it is a set group of names that they're allowed to select from.
Looking for quick simple and pretty. somewhere in the range of 120 names.
If you intend to look down the jQuery route, I suggest that this widget could possibly help you out (even if only for inspiration sakes). http://quasipartikel.at/multiselect/
I'm struggling to "visualize" your form for terms of "real-estate expendature" etc.
Not directly what you are looking for, but this plugin may help
http://devgrow.com/slidernav-jquery-plugin/
Typing with intellisense. Sorry - any graphical thing will look overloaded.
Or: A table with filter options on top (again, typing). THere simply is no other way.
What I would most likely do to achieve this is implement the auto filter pattern that you type in a text box a few letters of the name and then it would filter down all of the overall results to those containing that pattern. Then have a select all button that will let you check all of them, and then the user can manually uncheck a few instead of having to check all.
The other thing to do would be to offer some type of categorization of the data so that they could filter by category that would put people in probable groups that would want all them all together. Like IT, HR, Executive or something similar.

Drupal Multi-language: Simple strings not translated

I'm adding additional languages to a Drupal site that I'm building.
Getting the translation of content working is fairly easy using the Internationalisation module.
Yet, simple things such as date strings, i.e. day, month and year aren't translated.
I would expect simple things like this to be some of the first things to be translated.
Am I missing something?
For text to be translated, each module needs to pass display text through a specific function (named 't()') which allows the text to be translatable.
It's likely that some module writers are better at doing this consistently than others.
I found the solution to this in the end.
It came down to knowing what to search for in the translate interface admin section.
I was looking to translate month names into different languages and so search for strings matching 'November'. This always came up with nothing.
It truned out that I need to search for 'month'. This then allowed my to add translations for all of the month names and also other date related translations.
Very frustrating the effort required to find that out!

Best way to Search

I am building a real estate website. I have a table for properties (i.e. "houses"), a table for pictures, a table for features, etc. So each property's data comes from three, not only one table.
I need to provide a function that retrieves requested property data depending on a search criteria, for example:
property of the week
featured properties
properties on offer
the simple search
I have multiple drop-down lists for selecting country, region, area, bedrooms, price range, type, etc.
I already built many functions each dealing with one of the above cases, but I was wondering, if there was any other way of building one flexible mechanism that will retrieves whatever you want in a smart way, I mean one function that works for all cases?
I know my question is kind of vague and too broad, but bear with me please.
Thanks in advance.
PS: I am using ASP.NET 3.5, VB.NET, Visual Web Developer 2008 Express, SQL Server 2005 Express
I think you're looking to build an Advanced Search functionality that integrates with the default/simple search provided.
Why not build a single stored procedure to encapsulate all possible types of searches by specifying default values of parameters that are not passed.
In this manner, the simple search would be using all parameter defaults. Whenever any criteria is provided to narrow the search, the passed parameter value will be used by the Stored Procedure.
Is Lucene an option? Lucene.net is a great way to provide a quick and flexible search engine to your site.
When you use Lucene you also many other advantages, like fuzzy search etc...
http://www.codeproject.com/KB/library/IntroducingLucene.aspx
The question is twofold:
Can you logically unite the search for "properties of the week" and the search for "properties in this specific region, costing 100,000 or less" into a single database search?
Does it buy you anything to think of/create something that does 1.)? (Especially when you already have something that works.)
If you would answer both questions with "Yes", then I'd say you must extend the simple search. I suppose you already have a flag for each of your special cases ("property of the week", "property on offer", etc). Just add support for these flags to your simple search function.
Provide reasonable defaults for the search criteria and you can use simple search for all the cases you described.

Resources