dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: Select check box when option selected from list

Hybrid View

  1. #1
    Join Date
    Feb 2006
    Location
    Detroit, MI
    Posts
    118

    Select check box when option selected from list

    I have a form for signing someone up for email alerts. The user has several options for what type of alerts to get. One of these options is to be emailed when a specific interest rate becomes available for a loan. If they want this type of email they check a check box and then select the rate they want from a list. If they check the box for this type of alert, selecting a rate becomes required.

    What I want to do is make it so that if someone selects a rate from the list, it will automatically check the check box. I want it to do it in an AJAX way so that right when they select a rate form the list, they will see the check box become marked.

    Here is the form I have set up (This form is much longer with more alert options, but I cut it down for space):

    HTML Code:
    <form id="alerts" action="/about/mortgage-rate-alerts" method="post">
        <fieldset>
            <legend>Sign up for alerts below:</legend>
    
            <div>  
                <!-- BEGIN email_address -->  
                <p><label for="email_address">E-mail address:</label> <input class="text" id="email_address" tabindex="1000" type="text" name="alerts[emailAddress]"></p>
                    
                    
                <!-- END email_preferences -->
            </div>    
                
                <!--BEGIN ALERTS_RATE -->
                <div class="rate_container">  
                        <h2><input value="" type="hidden" name="alerts[rateAlert]">
    <label><input tabindex="1000" class="alert_check_box" name="alerts[rateAlert]" type="checkbox" value="1"> Rate Alert</label></h2>
    
                        <div id="rate_alert_headline">
                            	<p>Tell us exactly what rate youíre looking for and well get in touch when itís available.</p>
                        </div>
                        <p>
                            What rate do you want?
                            <select class="select" tabindex="1000" name="alerts[rate]">
    <option value="">Choose Rate</option>
    
    <option value="rate">rate</option>
    <option value="rate">rate</option>
    <option value="rate">rate</option>
    
    </select>
    
                        </p>
                        
                        	
                </div>    
                
                <div><input id="submit_form" value="Complete" tabindex="1000" src="sign_me_up.png" type="image" name="alerts[submit]"></div>
        </fieldset>
    </form>

  2. #2
    Join Date
    Feb 2006
    Location
    Detroit, MI
    Posts
    118
    seriously can't figure this out! help!!

  3. #3
    Join Date
    Jun 2009
    Posts
    112
    Okaay... don't think you need AJAX for this. In case you decide you don't, why not try putting an onChange on that select? Give your options values, and then create a "starting" choice of like "Select One" then, onChange, have the javascript check the value of that select, and so long as it doesn't equal the value of the "Select One" choice, check your check box.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles