Multiple "Allow other..." in list

rss

Posted by Sonoma - Jun 10 ’15 at 08:35

Good morning.

I have a need to allow the user to add their own items to a list. I know by default I can only have ONE "allow user to add their own" but in this case I need three.

 

Partil List Example:

7. Mammogram
8. Ultrasound, specify site
9. X-ray, specify site
10. Bone scan
11. Other, specify

 

If I only needed one I could easily do this. But I know I will need to have 2 extra fields with in my list.

Utilizing the provided example below which allows me to place the other any where I like with the text box right after it (items 8 and 9) how would I throw an extra field or two in it without breaking it? Field1Other, Field2Other.

 

Would I need to only do this?
var options1 = fd.field('Field1Other').control()._el().find('td');

 

Existing Example

//Race
var options = fd.field('Race').control()._el().find('td');
var content = '<table>';
content += '<tr>';
content += '<td>' + options.eq(0).html() + '</td>'; //Rows
content += '<td>' + options.eq(5).html() + '</td>'; //Rows             
content += '</tr>'
content += '<tr>';        
content += '<td>' + options.eq(1).html() + '</td>'; //Rows         
content += '<td>' + options.eq(8).html() + options.eq(9).html() + '</td>'; //Rows
content += '</tr>'
content += '<tr>';   
content += '<td>' + options.eq(2).html() + '</td>'; //Rows
content += '<td>' + options.eq(5).html() + '</td>'; //Rows       
content += '</tr>'
content += '<tr>';        
content += '<td>' + options.eq(3).html() + '</td>'; //Rows
content += '<td>' + options.eq(7).html() + '</td>'; //Rows         
content += '</tr>'
content += '<tr>';        
content += '<td>' + options.eq(4).html() + '</td>'; //Rows         
content += '</tr>'
content += '</table>';
fd.field('Race').control()._el().html(content);

// Race Other Text
$('label[for*=RaceField_ctl00_ctl08]').text('Other, specify');

 

 

Thank you.

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 8 years 2 months 19 days
    #1 by Dmitry Kozlov Jun 11 ’15 at 04:07

    Hi,

    What type of field do you use for the selection from Mammogram, Ultrasound, X-ray, Bone scan etc? Choice (DropDown) or Choice (Checkboxes)? You can add extra fields for additional information and display them conditionally based on the selection in the Choice field.

    http://formsdesigner.blogspot.com/2014/07/how-to-conditionally-hide-disable-make.html

  • Sonoma
    Member
    Member for: 7 years 2 months 16 days
    #2 by Sonoma Jun 11 ’15 at 07:51

    [#1]: Thank you. They are Choice (Checkboxes).

    But thinking more about it the MRI, Ultrasound and X-ray will need to be part of three other fields which could be text fields where user types in the site. If it is too crafty or would be a has to put them in as [#8] and 9 I could always see if I could display them after 11 instead. This may be my most complex form yet. I just need to twaek my html/jscript in a way that looks seamless to the eye.

    I will take a look at the link.

     

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 8 years 2 months 19 days
    #3 by Dmitry Kozlov Jun 15 ’15 at 01:58

    [#2]: You could split the field into several Yes/No fields. Based on the selection show or hide additional text fields.

  • Sonoma
    Member
    Member for: 7 years 2 months 16 days
    #4 by Sonoma Jun 15 ’15 at 08:59

    [#3]: Thanks. I will have to give it a try to envision how it will work.

     

    In the mean time I re-aranged the list to have the extra items appear at the end. In order to get it to work I still have to add the 3 extra fields as check boxes and display what I need to see. I am hoping I get approval so I can move on.

     

    image(hopefully shows up):

     

    code:


    //TestName
    var options = fd.field('TestName').control()._el().find('td');
    //var MRI = fd.field('TestNameMRI').control()._el().find('td');

    var content = '<table>';
    content += '<tr>';
    content += '<td>' + options.eq(0).html() + '</td>'; //Rows           
    content += '</tr>'
    content += '<tr>';    
    content += '<td>' + options.eq(1).html() + '</td>'; //Rows           
    content += '</tr>'
    content += '<tr>';        
    content += '<td>' + options.eq(2).html() + '</td>'; //Rows           
    content += '</tr>'
    content += '<tr>';        
    content += '<td>' + options.eq(3).html() + '</td>'; //Rows           
    content += '</tr>'
    content += '<tr>';              
    content += '<td>' + options.eq(4).html() + '</td>'; //Rows           
    content += '</tr>'
    content += '<tr>';    
    content += '<td>' + options.eq(5).html() + '</td>'; //Rows                     
    content += '</tr>'
    //content += '<tr>';    
    //    content += '<td>' + MRI.eq(1).html() + MRI.eq(2).html() + '</td>'; //Rows                     
    //content += '</tr>'
    //content += '<tr>';    
    //    content += '<td>' + "<input name=\"ctl00$ctl41$g_478b9b60_56ea_4681_bcf5_3c2a561f5596$TestNameMRIField$ctl00$ctl00$TextField\" title=\"TestNameMRI\" class=\"ms-long ms-spellcheck-true\" id=\"ctl00_ctl41_g_478b9b60_56ea_4681_bcf5_3c2a561f5596_TestNameMRIField_ctl00_ctl00_TextField\" type=\"text\" maxlength=\"255\">" + '</td>'; //Rows                     
    //content += '</tr>'
    content += '<tr>';   
    content += '<td>' + options.eq(6).html() + '</td>'; //Rows           
    content += '</tr>'
    content += '<tr>';    
    content += '<td>' + options.eq(7).html() +  options.eq(8).html() + '</td>'; //Rows       
    content += '</tr>'
    content += '</table>';
    fd.field('TestName').control()._el().html(content);
    //TestNameField_ctl00_ctl10
    $('label[for*=TestNameField_ctl00_ctl07]').text('Other (specify)');   

    //TestNameMRI
    var options = fd.field('TestNameMRI').control()._el().find('td');
    var content = '<table>';
    content += '<tr>';    
    content += '<td>' + options.eq(1).html() + options.eq(2).html() + '</td>'; //Rows                     
    content += '</tr>'
    content += '</table>';
    fd.field('TestNameMRI').control()._el().html(content);
    //TestNameField_ctl00_ctl10   
    $('label[for*=TestNameMRIField_ctl00_ctl01]').text('MRI, specify site');   


    //TestNameUltrasound
    var options = fd.field('TestNameUltrasound').control()._el().find('td');
    var content = '<table>';
    content += '<tr>';    
    content += '<td>' + options.eq(1).html() + options.eq(2).html() + '</td>'; //Rows                     
    content += '</tr>'
    content += '</table>';
    fd.field('TestNameUltrasound').control()._el().html(content);
    //TestNameField_ctl00_ctl10   
    $('label[for*=TestNameUltrasoundField_ctl00_ctl01]').text('Ultrasound, specify site');   


    //TestNameXRAY
    var options = fd.field('TestNameXRAY').control()._el().find('td');
    var content = '<table>';
    content += '<tr>';    
    content += '<td>' + options.eq(1).html() + options.eq(2).html() + '</td>'; //Rows                     
    content += '</tr>'
    content += '</table>';
    fd.field('TestNameXRAY').control()._el().html(content);
    //TestNameField_ctl00_ctl10   
    $('label[for*=TestNameXRAYField_ctl00_ctl01]').text('X-ray, specify site');   


     

  • Sonoma
    Member
    Member for: 7 years 2 months 16 days
    #5 by Sonoma Jun 15 ’15 at 09:02

    [#4]: Link to image

    https://www.dropbox.com/s/2finppwkxnw2lew/List%20sample.gif?dl=0

     

  • Sonoma
    Member
    Member for: 7 years 2 months 16 days
    #6 by Sonoma Oct 16 ’15 at 08:01

    I am able to add the extras using jscript. I can append to my selection and hide the rest.

    I will leave my exaple if anyone needs it.

    $('.fd_field[fd_name="HematologicalAdverseEvent"]').detach().appendTo('.fd_field[fd_name="AEType"]');
    $('.fd_field[fd_name="PainLocation"]').detach().appendTo('.fd_field[fd_name="AEType"]');
    $('.fd_field[fd_name="SkinToxicity"]').detach().appendTo('.fd_field[fd_name="AEType"]');

    example:

    I have 3 Other/Add specifics in my AEType. Here is one of them

    function SetAEType() {

     

    ...

    if (fd.field('AEType').value() == '5.\tSkin toxicity (specify: rash, erythematous or desquamatory rash, skin hyperpigmentation)') {
    //alert('5.\tSkin toxicity (specify: rash, erythematous or desquamatory rash, skin hyperpigmentation)');
    $('.fd_field[fd_name="SkinToxicity"]').show(); //Show SkinToxity field
    $('.fd_field[fd_name="HematologicalAdverseEvent"]').hide(); //Hide HAE field
    $('.fd_field[fd_name="PainLocation"]').hide();  //Hide Pan Location


    fd.field('PainLocation').value(''); //Clear value is edited or changed
    fd.field('HematologicalAdverseEvent').value(''); //Clear value is edited or changed

     

    ...


    }
    };

     

     

    // Calling setAEType when the user changes AEType
    fd.field('AEType').change(SetAEType);

    // Calling setAEType on form loading
    SetAEType();

     

     

  • Treat Assignment Help
    Treat Assignment Help
    Member
    Member for: 1 year 11 months 2 days
    #7 by Treat Assignment Help Jan 7 ’20 at 04:20

    Treat assignment help offers custom assignment online where you can get excellent writing services from our Professional writers for your assignments. Treat Assignment Help is top-notch solution for custom geography-assignment-help online in UK. Hire best coursework writers online and send your assignment requirements, our writing experts will give you affordable pricing quotation. for more info please email at: [email protected] ! Call us at Toll Free Number Or Whatsapp at: +44 7520644027 ..!!

  • jacoboram550
    Member
    Member for: 1 year 8 months 9 days
    #8 by jacoboram550 Mar 30 ’20 at 11:37

    You post is very helpful and especially students can get benefits from your ideas and increase their knowledge. I hope, you will send us more helpful posts. Dissertation writing services.

  • petewhiddon2
    Member
    Member for: 1 year 7 months 22 days
    #9 by petewhiddon2 Apr 18 ’20 at 06:36

    New Leaf CBD Review: Currently, many cases of different diseases are known each year and are believed to be on the rise. Many of these diseases are hereditary and many others develop due to the bad life habits that the person acquires and that over time, becomes a disease. On the other hand, those who already have sick family members prefer to avoid a certain lifestyle and start taking care of themselves early.

  • petewhiddon2
    Member
    Member for: 1 year 7 months 22 days
    #10 by petewhiddon2 Apr 18 ’20 at 06:37

    Empowered Boost Review: Men have 20 times more testosterone than women. And they need it. In fact, it is the hormone that determines them as males. Already from the embryo, it is key to the development of the male genital apparatus. And, when puberty arrives, the levels skyrocket and the reproductive system grows, the voice changes, the muscle increases and with it the strength, among other characteristics.

Displaying 1 to 10 of 13 messages
Previous12