WordPress.org

Ready to get started?Download WordPress

Forums

Participants Database
Help with signup template (6 posts)

  1. rwilki
    Member
    Posted 1 year ago #

    If I have 2 email fields and only the first one is visible by default. Then, if a visitor had filled out the field name “email1″, could I write some condition in the signup template like:

    if ( $this->field->name == 'email1' ) {
    
    if ( ! is_isset() ) $this->field->value = 'show->field->name == "email2"';
    
    }

    So, if someone fills out email1, then email2 shows...?

    Thanks,
    Bob

    http://wordpress.org/extend/plugins/participants-database/

  2. PayBas
    Member
    Posted 1 year ago #

    This is a possible javascript/jQuery solution. Seems to work well. Include this in your header.

    <?php wp_head(); ?>
    
    <script type="text/javascript">
    jQuery(document).ready(function(){
    	jQuery('input[name="email2"]').parentsUntil('tbody').hide();
    	jQuery('input[name="email1"]').change(function () {
    		jQuery('input[name="email2"]').parentsUntil('tbody').show();
    	})
    })
    </script>
    
    </head>
  3. rwilki
    Member
    Posted 1 year ago #

    wow this would be so cool! thanks. do I also need to reference an external jquery file?

    thanks,
    Bob

  4. PayBas
    Member
    Posted 1 year ago #

    As long as you include the code AFTER <?php wp_head(); ?>, jQuery should be already loaded.

  5. rwilki
    Member
    Posted 1 year ago #

    oh I got you. it's for the header file. at first I thought it went into the signup template file. Thanks so much! I'll try it out and report back. Really appreciate it!

    Thanks,
    Bob

  6. PayBas
    Member
    Posted 1 year ago #

    Hmmmm... I don't actually know. I'm just used to putting these kinds of scripts in the header.

    But I think you can put it anywhere you want, as long as it's after <?php wp_head(); ?> because jQuery needs to be loaded.

    Maybe if you put the code at the very bottom of the signup template, you won't even need to use
    jQuery(document).ready(function(){

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.