• Resolved chadtesting

    (@chadtesting)


    So I have a required dropdown list that I’m importing through csv, but the first entry needs to either be blank, or instructional text that cannot be chosen.

    CSV removes blank rows, and instructional text is valid as an entry, so how do I fix this problem?

    thank you.

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello,

    For example, if your CSV file includes two columns, and you are using the first column for the choices’ texts, and the second column for the choices’ values and you are using the comma symbol as the cells separator, then, the first row of data in the file, should be similar to:

    Select an option,

    I’ve left in blank the second column in the row.

    Best regards.

    Thread Starter chadtesting

    (@chadtesting)

    What if your data is just a single column with a heading?

    To work around this I created a column ‘field 0’ with text I don’t want to use, then filled column 2 ‘field 1’ with the data I want with a blank row at the top. I selected ‘field 1’ for select column for texts, and ‘field 1’ for select columns for values. Now my form populates with a blank field.

    I think that’s similar to your solution.

    Plugin Author codepeople

    (@codepeople)

    Hello,

    In this case define the CSV file rows as:

    ,
    Option A,
    Option B,
    Option C,

    but use in the DS field only the “Field 0”

    Best regards.

    Thread Starter chadtesting

    (@chadtesting)

    Ok I get it now. Thank you ??

    Thread Starter chadtesting

    (@chadtesting)

    I have a sort of follow-up to this question.

    If you use a DS dropdown to define a value, is it possible to link it to an adjacent field in your csv to display a read-only value? Sort of like a VLOOKUP in Excel?

    Plugin Author codepeople

    (@codepeople)

    Hello,

    If you want get a row based on the option selected in a DropDown field, I recommend you to use a RecordSet DS field to read the CSV file, and then, you can walk through the records as part of the equation.

    For example, assuming that CSV file includes the columns: column_a, column_b, and column_c, and you want get the record whose column_b matchs with the option selected in the DropDown field fieldname1, and the Recordset DS field is the fieldname2, the equation would be similar to:

    (function(){
        var records = fieldname2, row;
    
        foreach(var i in records)
        {
            if(records[i]['column_b'] == fieldname1)
            {
                row = records[i];
                break;
            }
        }
    
        /** USE THE row VARIABLE IN THE EQUATION **/
    }
    })()

    Best regards.

    Thread Starter chadtesting

    (@chadtesting)

    Thank you! One last thing.

    Is there a way to turn off the ‘required field’ option if a field is hidden?

    Plugin Author codepeople

    (@codepeople)

    Hello,

    Yes of course, you simply should untick the checkbox in the field’s properties. Furthermore, if the field is dependent, and it is inactive, the “required” property is ignore even if the checkbox is tickedin field’s properties.

    Best regards.

    Thread Starter chadtesting

    (@chadtesting)

    So if I’m using Jquery to hide a dropdown and it’s ticked as ‘required’ then it will ignore that property when hidden?

    I’m only asking again because my experience is different. I’m finding when it’s hidden and required, it won’t let me proceed.

    Plugin Author codepeople

    (@codepeople)

    Hello,

    To ignore a field you are hiding/showing programmatically, you should assign to the field the class special name: ignore

    but remember to remove the class name: ignore when the field be set as visible again.

    Best regards.

    Thread Starter chadtesting

    (@chadtesting)

    OK, then what is the opposite of the special class name ignore? Let’s say I assign my fields the class name ignore and want to set as visible

    Is it..

    jQuery(‘.socsci’).visible();

    ??

    Plugin Author codepeople

    (@codepeople)

    Hello,

    I’m sorry, but these are basic jQuery concepts. I recommend you the the jQuery documentation page.

    If you want hide the field with the class: socsci and ignore the editable fields on it.

    jQuery('.socsci').hide().find('input,select,textarea').addClass('ignore');

    and for showing it:

    jQuery('.socsci').show().find('input,select,textarea').removeClass('ignore');

    Best regards.

    Thread Starter chadtesting

    (@chadtesting)

    Perfect, thank you!

    Thread Starter chadtesting

    (@chadtesting)

    I have tested this extensively, and while it works perfectly for viewing my dropdowns, adding the ignore class to every other required dropdown except the one I’m viewing breaks my form. Even if I remove the class for each dropdown later in the form, it still won’t display my output. Toggling doesn’t work.

    Is there a way to ignore the ‘required’ function of the field, without ignoring the entire field?

    Thank you.

    Plugin Author codepeople

    (@codepeople)

    Hello,

    Simply add or remove the special class name: “required” to or from the fields. For example, if you want convert the fieldname1 as required programmatically, you should call a piece of code similar to:

    jQuery('[id*="fieldname'+'1_"]').addClass('required');

    but if the field is required, and you want convert it in optional, the piece of code to call would be:

    jQuery('[id*="fieldname'+'1_"]').removeClass('required');

    Note: I’m using the selector: '[id*="fieldname'+'1_"]' and not simply: '[id*="fieldname1_"]', because in the equations all texts with the format fieldname# are replaced by the corresponding fields’ values.

    Best regards.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘When importing from CSV to a required dropdown, how to make first row invalid?’ is closed to new replies.