Im doing a survey application . It is having option to add questions.If on clicks on add button it will show the text box for adding question and a select box for selecting question type(radio button , check box) once it fill the field i will store than in database ans display in UI. then the user have option for adding question above and below. if he add question above i need to reorder the question number below. if he add question in middle i need to update the question number below that. how can i solve this situation ?
In a similar situation, I have shown the list of items to be sorted in a table/grid and given the option to the user to move up or down the items in the grid as per their choice. I kept a column for order in the grid (hidden in my case) and a corresponding column in the database table. Whenever there is a reordering in the grid, I update the order by a swap operation for the two rows that are swapping position. So, once the user has done the reordering and save the order using a button, I use to update the order column according to the order in the front page.
https://pixbyfunc.appspot.com/pub/asq/asq.html is a running example of a contingent questionnaire. A different set of questions are presented based on if the user likes wine or not.
It's designed using JavaScript that looks like:
Q().ask("Have you had your drink today?");
Q('like-wine').using('radio', 'Yes', 'No').ask("Do you like wine?");
Q('like-wine').matches('no').naming('reason').using('textarea').ask("Why not?").abort();//stop the survey
Q().ask("How much do you drink a day?");
Q('which-wine').using('checkbox', 'Reds', 'Whites', 'Other').ask("What do you like?");
Q('which-wine').matches('reds').ask("If you would like to receive a free bottle of Chateau d'Yquem Sauternes 2004 from your Santa, please provide your email.");
Q().start();
You can view the source to see how Q is implemented and to modify to suit your needs.
Related
I am very new to programming but have come across a situation in my work where I believe I need to use some javascript to make my survey manageable for the participant. The client wants to use Qualtrics as a scheduling system. Faculty identify time slots that they are available and the survey would start by hiding the ones that they will not be available for. Then dynamically hides buttons as the quotas fill for a given time slot.
My matrix table is 10 columns x 15 rows to accommodate all the times and days. I'm trying to reuse snips of codes that I have found online and so far have gotten to:
Qualtrics.SurveyEngine.addOnload(function()
{
$("QR~QID14~1~4").up().hide();
});
This is hiding a choice, but instead of row 1 column 4 it is hiding row 1 column 15 (whose inspect element is QR~QID14~1~10). Whatever I change my column number to (4 in the example) it is always hiding the check box in the last column. I don't understand what I am doing wrong. So I've gone into my results and realize it is hiding the correct button but the rest of the buttons are shifting left so it appears that the last button is hidden.
Once I get it to hide the correct column I want to add conditions to my code that will hide it based on the value of a quota, which I believe would look like:
Qualtrics.SurveyEngine.addOnload(function()
{
if ('${qo://QUOTAID/QuotaCount}' > 0) $("QR~QID14~1~4").up().hide();
});
Where I would find the QUOTAID via Qualtric's piped text option
I know I can format this as a list but there are too many options for some faculty to make that look right.
You want to hide the contents of the table cell, not the cell itself.
Qualtrics.SurveyEngine.addOnload(function() {
$('QR~QID14~1~4').up('td').childElements().invoke('hide');
});
I have a Tabular Form with a few columns, one of which is a numeric entry that has values 1 or 0, represented by a checkbox.
I'd like to create a "master-checkbox" that would check all the checkboxes in this column, but it wouldn't sumbit the page, the user would have to do it manually by "Apply Changes".
I figured out that I need to use apex.item and some javascript and unfortunately, that's as far as I got.
Actually, it wasn't as easy as the google results suggest.
Apex' checkbox appears to be just a cosmetic thing and the real thing is hidden.
My colleague helped me to do something like this:
$("td[headers=APPROVED] input[type=checkbox]").attr("checked", 1); // this is the "visual" part
$("td[headers=APPROVED] input[type=hidden]").val(1); // and this is he one that gets stuff done
"APPROVED" is the name of the column I am manipulating.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
My apologies in advance if I posted this in the wrong place...
OK. I'd like to add a similar hierarchical/selectable list of data to my website as can be found on ebay's "sell a new item page" here:
http://cgi5.ebay.com/ws/eBayISAPI.dll?NewListing
Note: you may need to be able to log into ebay to follow the link. Sorry
(I've tried to post a screenshot to illustrate the table for those who can't follow the above link, but as I'm a new user to StackOverflow I'm not allowed to post images until my Reputation > 10. Bummer)
If you can't follow the link above, goto ebay.com, login (if you have an account), click the SELL tab->SELL AN ITEM and then the BROWSE CATEGORIES LINK which will bring up the list in question.
Ebay uses their version to make sure a seller lists their auction item in the proper category and I could use something similar for completely unrelated purposes on my own website.
It works like this: upon page load, column 1 is populated with a list of possible category options and when the user selects one of those options, a new (the 2nd) column of sub options is then displayed to the right of the first. When an option from column 2 is selected, column 3's options are displayed and so forth until the user has drilled down into the categories and arrives on one which does not have any additional subcategories. Ultimate, a single category number is displayed in the lower right hand corner one the user reaches the end of the category line.
2 questions:
To help me research how it works, what type of list is it? (Assuming it is a list and not a menu ect.)
In order for me to make one for my site, will it require adding code in javascript or are there online generators to make such an animal?
I've inspected the page's source before asking the question, but being fairly new to html/php and not having dabbled in javascript yet, I drew a blank on how to learn more.
Knowing what to call this type of list will help me google to find out how to make something that looks and functions in a similar manner for my data which is currently in a mySQL table.
Thanks in advance for any replies!
This can be achieved in HTML and its called 'selection list' with this code:
<select name="items" size="3">
<option value="ball">Ball</option>
<option value="toy">Toys</option>
<option value="something">Something</option>
</select>
You can see it in action here:
http://jsfiddle.net/5EXmc/
Of course you are going to need some javascript to understand which item was selected.
If you are interested in the javascript for this to displace what you selected:
http://jsfiddle.net/5EXmc/1/
$("select").change(function () {
var str = "";
$("select option:selected").each(function () {
str += $(this).text() + " ";
});
$("div").text(str);
}).change();
If you took 10 seconds to look at the HTML you'd learn that it's just a select element with a size property. This is just another mode of the input element.
I have a couple of custom entities, which are linked together with a many to many relationship, using a linking entity which contains some linking attributes. For the sake of clarity let's call these Superhero and Supervillain, and the link will be Fight.
(Superhero) 1 --------- * (Fight) * -------- 1 (Supervillain)
That is, each fight is between 1 superhero and 1 supervillain, and each superhero/suppervillain combo can have any number of fights maybe of different type - sword, fist, etc.
All simple stuff so far. Effectively, what I'm doing here is reproducting the new "Connections" functionality, but using a custom linking type that only works with Superheros and Supervillains. The reason for this is I want to show these as a separate navigation item in the left hand side of the form, rather than lump them all in under "Connections".
Now, from the Superhero form, when I look at the related entities in the left hand pane, I want to show a see a list of the Fights, along with the Supervillain that the Superhero was fighting. Simple enough, I can just customise the "Fight Associated View" to show the type of Fight, and the Supervillain entity. This lets me click straight through from the Superhero to the Supervillain he was fighting.
But how about if I want to do the same from Supervillain? The same "Fight Associated View" is shown for Supervillains as well, but needs to be customised to show the fight type and the related Superhero... But, I don't want a "one size fits all" associated view, with both Superhero and Supervillain fields.
I want the associated view to change according to whether I'm looking at a Superhero or a Supervillain. So I create two new views, each with the desired columns. I can now manually switch to these view when selecting the related list in each entity. This works fine, but I don't want this manual step every time I look at the Related fights.
So, finally I get to the point of the question: How can I automatically (i.e. through script, if necessary) select the default "Associated" view that will be shown for the Fights related to Superheros and Supervillains, dependent on the entity type?
Using form script, I can get the navigation item easily enough, but after that I am lost:
function SuperHero_OnLoad()
{
var fightItem = Xrm.Page.ui.navigation.items.get("nav_new_fight");
// What next?!
fightItem.MagicFunctionThatSelectsADefaultViewOrHacksIntoTheIframeParametersOrSomething();
}
Note: I know I can use a sub-grid in the main edit form, which lets you choose the view to display, but I don't want to clog the form up with more sub-grids. I want to use the Related tree on the left of the form.
ViewId in Customizations.xml does work, but you asked the question too early ;-)
There was a bug which was resolved in Update Rollup 10 and above. I had the same problem until the update.
I'm trying to create an auto complete field (using the script.aculo.us plugin) in a form for a category select, but I want the auto complete list to display a number next to each category (the number of other things in the same category). This is similar to the Tags field on stack overflow.
Right now I can display the number I want, but when I select any field the extra number gets dumped into the text field with the category. Currently I'm simply appending the number to each item on the array before I display it. How can I make it so when you select something from the list the number (enclosed in parentheses) does not get put into the text field. Thank you.
I finally solved my problem, I just needed to figure out what some of the plugin's options were. It turns out there is an option for the auto_complete_field helper called :select. The value you provide to this tells the JavaScript which part of the <li> element (the HTML tags the results are displayed in) to return to the text box.
The solution was a simple matter of enclosing the name of the category in a span with a special class and leaving the number part I didn't want outside of this class. This was easy since I was already using my own partial to display the results.