• Resolved Imagemidowpgm

    (@midowpgm)


    About the array problem
    This is a great plugin, I am a novice, can help me quickly and massively apply on the web
    Can I use it in an array
    var mail=[“${mailto1}”,”${mailto2}”,”${mailto3}”]
    I tried to use it like this, but it didn’t work
    var mail=[%%mail%%]
    [sc name=”form” mails=”${mailto1}”,”${mailto2}”,”${mailto3}”]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Imagevaakash

    (@vaakash)

    Hi @midowpgm,

    Sorry for the late reply.

    I guess the parameter name is incorrect.
    Since the custom parameter is “mail”, you have to use “mail” but you have used “mails”

    [sc name="form" mail="${mailto1},${mailto2},${mailto3}"]

    Please correct me if I have misunderstood.

    Thanks,
    Aakash

    Thread Starter Imagemidowpgm

    (@midowpgm)

    Thank you very much for your reply help
    I have tried [sc name=”form” mail=”${mailto1},${mailto2},${mailto3}”]
    But not the way i need
    For example var mail=[“${mailto1}”,”${mailto2}”,”${mailto3}”]
    The result of “mail.length” will be 3
    If using [“${mailto1},${mailto2},${mailto3}”]
    The result of “mail.length” will be 1
    I need to apply the results obtained to the count to match the order in which the next mail is sent

    Plugin Author Imagevaakash

    (@vaakash)

    Hi @midowpgm,

    I guess you are expecting some kind of program execution, but shortcoder is not expected to do them.

    If your shortcode content is “javascript” then you can perform such operations on the client/browser side.

    In your case to use javascript you have to wrap the code by <script> tags like below and set it as shortcode content.

    <script>
    var mail=["${mailto1}","${mailto2}","${mailto3}"];
    alert(mail.length);
    </script>

    Thanks,
    Aakash

    Thread Starter Imagemidowpgm

    (@midowpgm)

    Thank you for your quick reply, this is the way I originally used
    var c=url.searchParams.get(“count”);
    c++;
    document.getElementById(“count”).value = c;
    var mailarray=[“${mail1}”,”${mail2}”,”${mail3}”,”${mail4}”,”${mail5}”];
    var newarray=[];
    newarray=mailarray.filter(d=>d);
    if(newarray[c]){
    document.getElementById(“nextmail”).value = newarray[c];
    }

    I hope to change to use
    var c=url.searchParams.get(“count”);
    c++;
    document.getElementById(“count”).value = c;
    var mailarray=[“%%mail%%”];
    var newarray=[];
    newarray=mailarray.filter(d=>d);
    if(newarray[c]){
    document.getElementById(“nextmail”).value = newarray[c];
    }

    Shortcode usage
    [sc name=”next” mails=”${mail1}”,”${mail2}”,”${mail3}”,”${mail4}”,”${mail5}”]
    Of course, my usage is wrong, I want to ask for your help, is it possible to use it in the shortcode
    The number of ${mail1} is variable, maybe “${mail1}”,”${mail2}”,”${mail3}”,”${mail4}” maybe “${mail1}”,”${mail2}”

    Plugin Author Imagevaakash

    (@vaakash)

    Hi @midowpgm,

    The issue is the double quotes here.

    Please wrap the ${mail} list with single quote like below.

    [sc name=”next” mails=' ”${mail1}”,”${mail2}”,”${mail3}”,”${mail4}”,”${mail5}” ' ]

    Thanks,
    Aakash

    Thread Starter Imagemidowpgm

    (@midowpgm)

    Wow! So happy, I follow your instructions
    [sc name=”next” mails=’ “${mail1}”,”${mail2}”,”${mail3}”,”${mail4}”,”${mail5}” ‘]
    And also modified
    var mailarray=[” %%mail%% “]; Change to var mailarray=[%%mail%%];
    Solved my problem, thank you very much, this is really a great plugin, now I can use the shortcode more conveniently

    Plugin Author Imagevaakash

    (@vaakash)

    Hi @midowpgm,

    Happy that it helped you.
    Please do rate the plugin. It will be really helpful !

    Thanks,
    Aakash

    Thread Starter Imagemidowpgm

    (@midowpgm)

    Of course, good plugins have been rated and recommended

    • This reply was modified 5 years, 4 months ago by Imagemidowpgm.
Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘About Shortcoder’s use of arrays’ is closed to new replies.