• Resolved schmutly

    (@schmutly)


    Hello. This looks promising and testing it more
    before thinking of upgrading for my customer.
    I have it working on a page with an embedded
    contact form (Contact7 plugin).(using shortcode)
    The form loads within the modal window, great.
    When filled in the form says at bottom of
    that form is window: Thank you (ticked).
    But i am using this same form when someone want to
    inquire about another item on that page but when clicking
    the button for modal again it hasn’t RESET that form and
    the “tick +thanks” is still in that modal window.
    Is there some JS code or setting i can add that resets
    that ready as a new form?

    https://www.ads-software.com/plugins/easy-modal/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Daniel Iser

    (@danieliser)

    Hey schmutly,

    You can use an override to open the modal. This should result in the desired effect.

    try adding something like this to your themes JS

    jQuery('.eModal-1').click(function(e){
      e.preventDefault();
      jQuery('form', '#eModal-1')[0].reset();
      jQuery('#eModal-1').emodal('open');
    });

    Hope this helps.

    Thread Starter schmutly

    (@schmutly)

    Hi Daniel,
    that didn’t work as i may not have explained it well.
    So i took a screenshot and more info on the image.
    Here
    I think its more to do with the contact7 form.
    I put these 2 lines in my additional settings of the contact form 7
    on_sent_ok: “setTimeout(function()$(‘.modal.active’).emodal(‘close’);},5000);”
    and
    on_sent_ok: “hideSubmit();”
    These both work and do the job i want, but after modal closes as i browse to other pages i want to “enquire” about something else and when i click the button to open the form is “cleared” and empty from the last successful “SEND” but that green “success” box still shows at bottom, im trying to clear THAT as well..
    Thanks muchly,
    Robbie

    Plugin Author Daniel Iser

    (@danieliser)

    You can simply add something like $('.success', '#eModal-1').remove(). Add that to the script i gave above and everytime one of your links is clicked your form will be cleared and the success message removed.

    Thread Starter schmutly

    (@schmutly)

    Thanks…I’ll give that a go shortly then report back and rate the reply ?? back asap.
    Rob

    Thread Starter schmutly

    (@schmutly)

    Damn,no good…if i do a CTRL+F5 refresh its gone.
    The first code you gave me, when i click to open modal it popups up the closes then opens again..so not sure if its in right place.
    I copied it to my:
    0:/public_html/wp-content/themes/self-titled/styles/capital-boxed/js/
    so assuming this is correct..will have a bit more of a check in case of typos. thx

    Thread Starter schmutly

    (@schmutly)

    OK…well the above didnt work but thats ok ??
    I went to the Contact Form 7 forum and found that someone just used a Javascript page refresh, namely: on_sent_ok: “location.reload(true);”
    So now:
    (1): on_sent_ok: “$(‘.wpcf7-mail-sent-ok’).ajaxComplete(function() {$(this).delay(1000).fadeOut(‘slow’);});” <–This Fades out the SUCCESS BOX
    (2):on_sent_ok: “setTimeout(function()$(‘.modal.active’).emodal(‘close’);},5000);”
    <–This closes the Modal window after 5 secs.
    (3): on_sent_ok: “hideSubmit();” <–my JS to hide the submit button and show an INFO box telling others to add each movie title to the form and when complete to click here…which hides the infobox and shows the submit button (i dont want people submit for 5 movies when they can add 5 to the same form, even when modal window is closed it still retains the inputted info until a “submit” (I’m glad for that..must be using cookies or localStorage)
    (4): And finally i needed to do a “REFRESH” to the page because for some reason the “success” box still wasn’t clearing but this refreshed and cleared it–>on_sent_ok: “location.reload(true);” So that’s great…

    Just in case someone else needed some info.
    Will rate plugin after..thanks again for your help
    Robbie

    on_sent_ok: “$(‘.wpcf7-mail-sent-ok’).ajaxComplete(function() {$(this).delay(1000).fadeOut(‘slow’);});”

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Contact shortcode not reseting’ is closed to new replies.