Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Jimmy,

    If you just enter an image tag as the answer it will work:

    <img src="path/to/image.jpg" />

    this is how i did it:

    you’ll need to add alerts to the wp-polls. php

    wp_localize_script('wp-polls', 'pollsL10n', array(
    		'ajax_url' => admin_url('admin-ajax.php', (is_ssl() ? 'https' : 'http')),
    		'text_wait' => __('Your last request is still being processed. Please wait a while ...', 'wp-polls'),
    		'text_valid' => __('Please choose a valid poll answer.', 'wp-polls'),
    		'text_name' => __('Please enter your name.', 'wp-polls'),
    		'text_tandc' => __('Please accept the terms and conditions.', 'wp-polls'),
    		'text_email' => __('Please enter a valid email address.', 'wp-polls'),
    		'text_carrier' => __('Please enter your current mobile carrier.', 'wp-polls'),
    		'text_multiple' => __('Maximum number of choices allowed: ', 'wp-polls'),
    		'show_loading' => intval($poll_ajax_style['loading']),
    		'show_fading' => intval($poll_ajax_style['fading'])
    	));

    and then in polls-js

    if(poll_multiple_ans > 0) {
    			if(poll_multiple_ans_count > 0 && poll_multiple_ans_count <= poll_multiple_ans) {
    				poll_answer_id = poll_answer_id.substring(0, (poll_answer_id.length-1));
    				poll_process();
    			} else if(poll_multiple_ans_count == 0) {
    				set_is_being_voted(false);
    				alert(pollsL10n.text_valid);
    			} else {
    				set_is_being_voted(false);
    				alert(pollsL10n.text_multiple + ' ' + poll_multiple_ans);
    			}
    		} else {
    			 if(pollip_name == '') {
    				set_is_being_voted(false);
    				var name_alert = pollsL10n.text_name + "\n";
    			} else{var name_alert = ''}
    
    			if(pollip_email == '') {
    				set_is_being_voted(false);
    				var email_alert = pollsL10n.text_email + "\n";
    			} else{var email_alert = ''}
    
    			if(pollip_carrier == '') {
    				set_is_being_voted(false);
    				var carrier_alert = pollsL10n.text_carrier + "\n";
    			} else{var carrier_alert = ''}
    
    			if(pollip_rules !== 1) {
    				set_is_being_voted(false);
    				var tandc_alert = pollsL10n.text_tandc;
    			} else{var tandc_alert = ''}
    
    			if(poll_answer_id > 0 && pollip_name !== '' && pollip_email !== '' && pollip_carrier !== '' && pollip_rules == 1) {
    				poll_process();
    			} else {
    				set_is_being_voted(false);
    				alert(pollsL10n.text_valid + "\n" + name_alert + email_alert +  carrier_alert + tandc_alert);
    			}
    		}
    	} else {
    		alert(pollsL10n.text_wait);
    	}
    }

    Yeah, that’s it. Thanks, monweb.

    oh yeah, that would have been helpful…

    ok, this is how i got it to work. Not saying this is the best way to do it, or even a good/secure way to do it – but it throws data in the table. I added my extra fields to polls_ip through phpmyadmin.

    I added my fields to the form footer in the template interface:

    <div id="frm_field_8_container" class="frm_form_field form-field  frm_required_field frm_top_container">
        <label class="frm_primary_label">NAME    </label>
        <input type="text" id="pollip_name" name="pollip_name" value="" class="texty"></div>
    
    <div id="frm_field_9_container" class="frm_form_field form-field  frm_required_field frm_top_container">
        <label class="frm_primary_label">EMAIL  </label>
        <input type="text" id="pollip_email" name="pollip_email" value="" class="text required">
     </div>
    
    <div id="frm_field_10_container" class="frm_form_field form-field  frm_required_field frm_top_container">
        <label class="frm_primary_label">ZIP CODE</label>
        <input type="text" id="pollip_zipcode" name="pollip_zipcode" value="" class="text required">
    </div>
    <div id="frm_field_12_container" class="frm_form_field form-field  frm_required_field frm_top_container">
        <label class="frm_primary_label">CURRENT CARRIER    </label>
        <input type="text" id="pollip_carrier" name="pollip_carrier" value="" class="text required">
    </div>

    Then I changed the polls-js.js to the polls-js.dev.js in wp-polls.php.

    Then in polls-js.dev.js at line 19:

    var pollip_name = '';
    var pollip_email = '';
    var pollip_zipcode = '';
    var pollip_carrier = '';

    Under this function jQuery('#polls_form_' + poll_id + ' input:checkbox, #polls_form_' + poll_id + ' input:radio').each(function(i) I added:

    jQuery('.texty').each(function(){
    
    				pollip_name = jQuery('#pollip_name').val();
    				pollip_email = jQuery('#pollip_email').val();
    				pollip_zipcode = jQuery('#pollip_zipcode').val();
    				pollip_gender = jQuery('#pollip_gender').val();
    				pollip_carrier = jQuery('#pollip_carrier').val();
    
    		});

    Then in wp-polls.php line 1305:

    $pollip_name= $_POST["pollip_name"];
      $pollip_email= $_POST["pollip_email"];
      $pollip_zipcode= $_POST["pollip_zipcode"];
      $pollip_carrier= $_POST["pollip_carrier"];

    Then updated this query to include my fields:

    INSERT INTO $wpdb->pollsip VALUES (0, $poll_id, $polla_aid, '$pollip_ip', '$pollip_host', '$pollip_timestamp', '$pollip_user', $pollip_userid, '$pollip_name', '$pollip_email', '$pollip_zipcode', '$pollip_carrier')

    I’m looking to do the exact same thing. How did you finally solve it?

Viewing 6 replies - 1 through 6 (of 6 total)