• In acest form toate campurile sunt obligatorii dar si trebuiesc sa respecte un anumit format (ex. email). Eu vreau sa pot controla aceste restrictii. Pare a fi un atribut pattern care trebuie modificat, insa nu gasesc nicaieri asa ceva in fisierul sursa.

    Form-ul nu este un plugin! Este un ‘page template’ al temei.

    Aveti ideea de unde as putea modifica acele restrictii?

Vizualizare 4 răspunsuri - 1 la 4 (din 4 în total)
  • Inițiator fir de discuții andrei141592

    (@andrei141592)

    Fisierul sursa:

    <?php if ( ! isset( $_SESSION ) ) session_start();
    /*
    Template Name: Contact Page
    */
    ?>
    <?php
    	$et_ptemplate_settings = array();
    	$et_ptemplate_settings = maybe_unserialize( get_post_meta(get_the_ID(),'et_ptemplate_settings',true) );
    
    	$fullwidth = isset( $et_ptemplate_settings['et_fullwidthpage'] ) ? (bool) $et_ptemplate_settings['et_fullwidthpage'] : false;
    
    	$et_regenerate_numbers = isset( $et_ptemplate_settings['et_regenerate_numbers'] ) ? (bool) $et_ptemplate_settings['et_regenerate_numbers'] : false;
    
    	$et_error_message = '';
    	$et_contact_error = false;
    
    	if ( isset($_POST['et_contactform_submit']) ) {
    		if ( !isset($_POST['et_contact_captcha']) || empty($_POST['et_contact_captcha']) ) {
    			$et_error_message .= '<p>' . esc_html__('Make sure you entered the captcha. ','SimplePress') . '</p>';
    			$et_contact_error = true;
    		} else if ( $_POST['et_contact_captcha'] <> ( $_SESSION['et_first_digit'] + $_SESSION['et_second_digit'] ) ) {
    			$et_numbers_string = $et_regenerate_numbers ? esc_html__('Numbers regenerated.','SimplePress') : '';
    			$et_error_message .= '<p>' . esc_html__('You entered the wrong number in captcha. ','SimplePress') . $et_numbers_string . '</p>';
    
    			if ($et_regenerate_numbers) {
    				unset( $_SESSION['et_first_digit'] );
    				unset( $_SESSION['et_second_digit'] );
    			}
    
    			$et_contact_error = true;
    		} else if ( empty($_POST['et_contact_name']) || empty($_POST['et_contact_email']) || empty($_POST['et_contact_subject']) || empty($_POST['et_contact_message']) ){
    			$et_error_message .= '<p>' . esc_html__('Make sure you fill all fields. ','SimplePress') . '</p>';
    			$et_contact_error = true;
    		}
    
    		if ( !is_email( $_POST['et_contact_email'] ) ) {
    			$et_error_message .= '<p>' . esc_html__('Invalid Email. ','SimplePress') . '</p>';
    			$et_contact_error = true;
    		}
    	} else {
    		$et_contact_error = true;
    		if ( isset($_SESSION['et_first_digit'] ) ) unset( $_SESSION['et_first_digit'] );
    		if ( isset($_SESSION['et_second_digit'] ) ) unset( $_SESSION['et_second_digit'] );
    	}
    
    	if ( !isset($_SESSION['et_first_digit'] ) ) $_SESSION['et_first_digit'] = $et_first_digit = rand(1, 15);
    	else $et_first_digit = $_SESSION['et_first_digit'];
    
    	if ( !isset($_SESSION['et_second_digit'] ) ) $_SESSION['et_second_digit'] = $et_second_digit = rand(1, 15);
    	else $et_second_digit = $_SESSION['et_second_digit'];
    
    	if ( ! $et_contact_error && isset( $_POST['_wpnonce-et-contact-form-submitted'] ) && wp_verify_nonce( $_POST['_wpnonce-et-contact-form-submitted'], 'et-contact-form-submit' ) ) {
    		$et_email_to = ( isset($et_ptemplate_settings['et_email_to']) && !empty($et_ptemplate_settings['et_email_to']) ) ? $et_ptemplate_settings['et_email_to'] : get_site_option('admin_email');
    
    		$et_site_name = is_multisite() ? $current_site->site_name : get_bloginfo('name');
    
    		$contact_name 	= sanitize_text_field( $_POST['et_contact_name'] );
    		$contact_email 	= sanitize_email( $_POST['et_contact_email'] );
    
    		$headers  = 'From: ' . $contact_name . ' <' . $contact_email . '>' . "\r\n";
    		$headers .= 'Reply-To: ' . $contact_name . ' <' . $contact_email . '>';
    
    		wp_mail( apply_filters( 'et_contact_page_email_to', $et_email_to ), sprintf( '[%s] ' . sanitize_text_field( $_POST['et_contact_subject'] ), $et_site_name ), wp_strip_all_tags( $_POST['et_contact_message'] ), apply_filters( 'et_contact_page_headers', $headers, $contact_name, $contact_email ) );
    
    		$et_error_message = '<p>' . esc_html__('Thanks for contacting us','SimplePress') . '</p>';
    	}
    ?>
    
    <?php get_header(); ?>
    	<div id="content"<?php if ( $fullwidth ) echo ' class="full"'; ?>>
        	<div class="content_wrap<?php if( $fullwidth ) echo ' full'; ?>">
                <div class="content_wrap<?php if ( $fullwidth ) echo ' full'; ?>">
                	<div id="posts"<?php if( $fullwidth ) echo 'class="post_full"'; ?>>
    				<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    					<?php if (get_option('simplepress_integration_single_top') <> '' && get_option('simplepress_integrate_singletop_enable') == 'on') echo(get_option('simplepress_integration_single_top')); ?>
    					<?php $thumb = '';
                        $width = 182;
                        $height = 182;
                        $classtext = '';
                        $titletext = get_the_title();
                        $thumbnail = get_thumbnail($width,$height,$classtext,$titletext,$titletext);
                        $thumb = $thumbnail["thumb"]; ?>
                        <h1 class="title"><?php the_title(); ?></h1>
                        <br class="clear" />
                        <div class="post<?php if($fullwidth) echo(' post_full');?>">
                            <?php if ($thumb <> '' && get_option('simplepress_page_thumbnails') == 'on') { ?>
                            <div class="thumb">
                                <div>
                                    <span class="image" style="background-image: url(<?php print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, $classtext, true, true); ?>);">
                                        <img src="<?php echo get_template_directory_uri(); ?>/images/thumb-overlay.png" alt="" />
                                    </span>
                                </div>
                                <span class="shadow"></span>
                            </div>
                            <?php }; ?>
                                    <?php the_content(''); ?>
                                <br class="clear" />
    
    							<div id="et-contact">
    
    								<div id="et-contact-message"><?php echo($et_error_message); ?> </div>
    
    								<?php if ( $et_contact_error ) { ?>
    									<form action="<?php echo esc_url( get_permalink( get_the_ID() ) ); ?>" method="post" id="et_contact_form">
    										<div id="et_contact_left">
    											<p class="clearfix">
    												<label for="et_contact_name" class="et_contact_form_label"><?php esc_html_e('Name','SimplePress'); ?></label>
    												<input type="text" name="et_contact_name" value="<?php if ( isset($_POST['et_contact_name']) ) echo esc_attr($_POST['et_contact_name']); else esc_attr_e('Name','SimplePress'); ?>" id="et_contact_name" class="input" />
    											</p>
    
    											<p class="clearfix">
    												<label for="et_contact_email" class="et_contact_form_label"><?php esc_html_e('Email Address','SimplePress'); ?></label>
    												<input type="text" name="et_contact_email" value="<?php if ( isset($_POST['et_contact_email']) ) echo esc_attr($_POST['et_contact_email']); else esc_attr_e('Email Address','SimplePress'); ?>" id="et_contact_email" class="input" />
    											</p>
    
    											<p class="clearfix">
    												<label for="et_contact_subject" class="et_contact_form_label"><?php esc_html_e('Subject','SimplePress'); ?></label>
    												<input type="text" name="et_contact_subject" value="<?php if ( isset($_POST['et_contact_subject']) ) echo esc_attr($_POST['et_contact_subject']); else esc_attr_e('Subject','SimplePress'); ?>" id="et_contact_subject" class="input" />
    											</p>
    										</div> <!-- #et_contact_left -->
    
    										<div id="et_contact_right">
    											<p class="clearfix">
    												<?php
    													esc_html_e('Captcha: ','SimplePress');
    													echo '<br/>';
    													echo esc_attr($et_first_digit) . ' + ' . esc_attr($et_second_digit) . ' = ';
    												?>
    												<input type="text" name="et_contact_captcha" value="<?php if ( isset($_POST['et_contact_captcha']) ) echo esc_attr($_POST['et_contact_captcha']); ?>" id="et_contact_captcha" class="input" size="2" />
    											</p>
    										</div> <!-- #et_contact_right -->
    
    										<div class="clear"></div>
    
    										<p class="clearfix">
    											<label for="et_contact_message" class="et_contact_form_label"><?php esc_html_e('Message','SimplePress'); ?></label>
    											<textarea class="input" id="et_contact_message" name="et_contact_message"><?php if ( isset($_POST['et_contact_message']) ) echo esc_textarea($_POST['et_contact_message']); else echo esc_textarea( __('Message','SimplePress') ); ?></textarea>
    										</p>
    
    										<input type="hidden" name="et_contactform_submit" value="et_contact_proccess" />
    
    										<input type="reset" id="et_contact_reset" value="<?php esc_attr_e('Reset','SimplePress'); ?>" />
    										<input class="et_contact_submit" type="submit" value="<?php esc_attr_e('Submit','SimplePress'); ?>" id="et_contact_submit" />
    
    										<?php wp_nonce_field( 'et-contact-form-submit', '_wpnonce-et-contact-form-submitted' ); ?>
    									</form>
    								<?php } ?>
    							</div> <!-- end #et-contact -->
    
    							<div class="clear"></div>
    
                                <?php edit_post_link(esc_html__('Edit this page','SimplePress')); ?>
                        <?php if (get_option('simplepress_integration_single_bottom') <> '' && get_option('simplepress_integrate_singlebottom_enable') == 'on') echo(get_option('simplepress_integration_single_bottom')); ?>
                        <?php if (get_option('simplepress_468_enable') == 'on') { ?>
                            <?php if(get_option('simplepress_468_adsense') <> '') echo(get_option('simplepress_468_adsense'));
                            else { ?>
                                <a href="<?php echo esc_url(get_option('simplepress_468_url')); ?>"><img src="<?php echo esc_url(get_option('simplepress_468_image')); ?>" alt="468 ad" class="foursixeight" /></a>
                            <?php } ?>
                        <?php } ?>
                        </div><!-- .post -->
    				<?php endwhile; endif; ?>
    				</div><!-- #posts -->
    				<?php if (!$fullwidth) get_sidebar(); ?>
    			</div><!-- .content_wrap -->
            </div><!-- .content_wrap -->
        </div><!-- #content -->
    </div><!-- .wrapper -->
    <?php get_footer(); ?>

    Acesta e formul

    <div id="et-contact">
    
    								<div id="et-contact-message"><?php echo($et_error_message); ?> </div>
    
    								<?php if ( $et_contact_error ) { ?>
    									<form action="<?php echo esc_url( get_permalink( get_the_ID() ) ); ?>" method="post" id="et_contact_form">
    										<div id="et_contact_left">
    											<p class="clearfix">
    												<label for="et_contact_name" class="et_contact_form_label"><?php esc_html_e('Name','SimplePress'); ?></label>
    												<input type="text" name="et_contact_name" value="<?php if ( isset($_POST['et_contact_name']) ) echo esc_attr($_POST['et_contact_name']); else esc_attr_e('Name','SimplePress'); ?>" id="et_contact_name" class="input" />
    											</p>
    
    											<p class="clearfix">
    												<label for="et_contact_email" class="et_contact_form_label"><?php esc_html_e('Email Address','SimplePress'); ?></label>
    												<input type="text" name="et_contact_email" value="<?php if ( isset($_POST['et_contact_email']) ) echo esc_attr($_POST['et_contact_email']); else esc_attr_e('Email Address','SimplePress'); ?>" id="et_contact_email" class="input" />
    											</p>
    
    											<p class="clearfix">
    												<label for="et_contact_subject" class="et_contact_form_label"><?php esc_html_e('Subject','SimplePress'); ?></label>
    												<input type="text" name="et_contact_subject" value="<?php if ( isset($_POST['et_contact_subject']) ) echo esc_attr($_POST['et_contact_subject']); else esc_attr_e('Subject','SimplePress'); ?>" id="et_contact_subject" class="input" />
    											</p>
    										</div> <!-- #et_contact_left -->
    
    										<div id="et_contact_right">
    											<p class="clearfix">
    												<?php
    													esc_html_e('Captcha: ','SimplePress');
    													echo '<br/>';
    													echo esc_attr($et_first_digit) . ' + ' . esc_attr($et_second_digit) . ' = ';
    												?>
    												<input type="text" name="et_contact_captcha" value="<?php if ( isset($_POST['et_contact_captcha']) ) echo esc_attr($_POST['et_contact_captcha']); ?>" id="et_contact_captcha" class="input" size="2" />
    											</p>
    										</div> <!-- #et_contact_right -->
    
    										<div class="clear"></div>
    
    										<p class="clearfix">
    											<label for="et_contact_message" class="et_contact_form_label"><?php esc_html_e('Message','SimplePress'); ?></label>
    											<textarea class="input" id="et_contact_message" name="et_contact_message"><?php if ( isset($_POST['et_contact_message']) ) echo esc_textarea($_POST['et_contact_message']); else echo esc_textarea( __('Message','SimplePress') ); ?></textarea>
    										</p>
    
    										<input type="hidden" name="et_contactform_submit" value="et_contact_proccess" />
    
    										<input type="reset" id="et_contact_reset" value="<?php esc_attr_e('Reset','SimplePress'); ?>" />
    										<input class="et_contact_submit" type="submit" value="<?php esc_attr_e('Submit','SimplePress'); ?>" id="et_contact_submit" />
    
    										<?php wp_nonce_field( 'et-contact-form-submit', '_wpnonce-et-contact-form-submitted' ); ?>
    									</form>
    								<?php } ?>
    							</div> <!-- end #et-contact -->

    Pe rind:

    • Name
    • <p class="clearfix">
      												<label for="et_contact_name" class="et_contact_form_label"><?php esc_html_e('Name','SimplePress'); ?></label>
      												<input type="text" name="et_contact_name" value="<?php if ( isset($_POST['et_contact_name']) ) echo esc_attr($_POST['et_contact_name']); else esc_attr_e('Name','SimplePress'); ?>" id="et_contact_name" class="input" />
      											</p>
    • Email
    • <p class="clearfix">
      												<label for="et_contact_email" class="et_contact_form_label"><?php esc_html_e('Email Address','SimplePress'); ?></label>
      												<input type="text" name="et_contact_email" value="<?php if ( isset($_POST['et_contact_email']) ) echo esc_attr($_POST['et_contact_email']); else esc_attr_e('Email Address','SimplePress'); ?>" id="et_contact_email" class="input" />
      											</p>
    • Subiect
    • <p class="clearfix">
      												<label for="et_contact_subject" class="et_contact_form_label"><?php esc_html_e('Subject','SimplePress'); ?></label>
      												<input type="text" name="et_contact_subject" value="<?php if ( isset($_POST['et_contact_subject']) ) echo esc_attr($_POST['et_contact_subject']); else esc_attr_e('Subject','SimplePress'); ?>" id="et_contact_subject" class="input" />
      											</p>

      Poti introduce si altele,ori poti scoate,depinde ce doresti.

    Inițiator fir de discuții andrei141592

    (@andrei141592)

    uite ce vreau eu sa modific:
    http://www37.zippyshare.com/v/86322171/file.html

    Stiu sa citesc cod CSS, HTML si PHP, insa acele erori nu stiu de unde sunt!

    Multumesc pentru raspuns!

    Acestea doar prin fisierele de localizare le poti schimba,de exemplu acel „Fill email address field” adica „completati campul adresi de email”.Normal in fisierele temei respective.Acesta o poti face cu software-ul Poedit

Vizualizare 4 răspunsuri - 1 la 4 (din 4 în total)
  • Subiectul „Modificarea restrictiilor unui form” este închis pentru răspunsuri noi.