• Resolved johnhorning-1

    (@johnhorning-1)


    I have a long poll and the Vote button is hidden until you scroll down. Some users make a selection and don’t realize they need to scroll down and click Vote. It would be very useful if users could vote without having to click Vote”. I don’t know much about javascript, but perhaps it could be used for that purpose.
    John

    http://wordpress.org/plugins/yop-poll/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author YOP

    (@yourownprogrammer)

    Hi John,

    Please edit inc/yop_poll_model.php and on line 3699 replace these 2 blocks

    if( $multiple_answers ) {}
    else {}

    with

    if ( $multiple_answers ) {
    							if ( isset( $answer_options['is_default_answer'] ) && 'yes' == $answer_options['is_default_answer'] )
    								$temp_string	= str_ireplace( '%POLL-ANSWER-CHECK-INPUT%', '<input type="checkbox" checked="checked" value="'.$answer['id'].'" name="yop_poll_answer['.$answer['id'].']" id="yop-poll-answer-'.$answer['id'].'" />', $m[5] );
    							else
    								$temp_string	= str_ireplace( '%POLL-ANSWER-CHECK-INPUT%', '<input type="checkbox" value="'.$answer['id'].'" name="yop_poll_answer['.$answer['id'].']" id="yop-poll-answer-'.$answer['id'].'" />', $m[5] );
    						}
    						else {
    							if ( isset( $answer_options['is_default_answer'] ) && 'yes' == $answer_options['is_default_answer'] )
    								$temp_string	= str_ireplace( '%POLL-ANSWER-CHECK-INPUT%', '<input type="radio" onclick="if( jQuery(this).is(\':checked\') ) jQuery(this).closest(\'form\').find(\'button[class=yop_poll_vote_button]\').click()" checked="checked" value="'.$answer['id'].'" name="yop_poll_answer" id="yop-poll-answer-'.$answer['id'].'" />', $m[5] );
    							else
    								$temp_string	= str_ireplace( '%POLL-ANSWER-CHECK-INPUT%', '<input type="radio" onclick="if( jQuery(this).is(\':checked\') ) jQuery(this).closest(\'form\').find(\'button[class=yop_poll_vote_button]\').click()" value="'.$answer['id'].'" name="yop_poll_answer" id="yop-poll-answer-'.$answer['id'].'" />', $m[5] );
    						}

    Please note that once you save the changes they will apply on all your polls.

    Also, if in “Options” you set “Vote as WordPress User” and “Vote as Anonymous User” to “Yes”, then the vote will not be registered unless
    the users click on the corresponding buttons.

    Best wishes,

    YOP Team

    Thread Starter johnhorning-1

    (@johnhorning-1)

    Thanks! Works like a charm! You guys are the best!

    Thread Starter johnhorning-1

    (@johnhorning-1)

    An additional note – I tried deleting the “vote” button from the template, but nothing happens when you select an answer in the poll. So I put it back in, but used CSS to hide it (display:none).

    Thread Starter johnhorning-1

    (@johnhorning-1)

    Okay- I may need to hire you on this one. Your javascript code above works fine when using the shortcode in a regular post, but now I’m trying to put it on a page where shortcodes don’t normally work. I inserted this into the template file:

    <?php echo do_shortcode(‘[yop_poll id=”1″]’); ?>

    Now the poll shows up, but nothing happens when I select an answer. I then made sure the javascript was called in the head by copying and pasting it from a page where it was working, but still no luck.

    Any suggestions?

    Plugin Author YOP

    (@yourownprogrammer)

    Hey John,

    Please add the JavaScript code in the footer and try again.

    Regards,

    YOP Team

    Thread Starter johnhorning-1

    (@johnhorning-1)

    Thanks, but still no luck. Can you tell me what the javascript code should be or at least the names of the files?

    Plugin Author YOP

    (@yourownprogrammer)

    Hi John,

    Please send us a link to the page where you have the poll.

    Best wishes,

    YOP Team

    Plugin Author YOP

    (@yourownprogrammer)

    Hey John,

    In the file you inserted <?php echo do_shortcode(‘[yop_poll id=”1″]’); ?>
    try to replace this line with <?php return_yop_poll(1); ?>

    Regards,

    YOP Team

    Thread Starter johnhorning-1

    (@johnhorning-1)

    I tried your php code above – no luck, although it may work if I played around more with the javascript.

    I did, however, find a solution – iframe! Check it out here:
    http://bullbord.com/apps/contest/best-kent-restaurant/

    still a work in progress…

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘form submission without clicking "Vote" [feature request]’ is closed to new replies.