Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6213895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:46:42+00:00 2026-05-24T06:46:42+00:00

The form and script are show below and I appreciate all help on this.

  • 0
    The form and script are show below and I appreciate all help on this.




            $(document).ready(function(){


        function displayStory()
            {
                $('#target').toggle();
                createStory();
                //$('#create button[type="submit"]').val();

            }
            function hideStory()
            {
                $('#target').hide();

                $('#storyform input[type="text"]').val("");
                //$( "#storyform" ).resetForm();

            }

        $("#clear").click(hideStory);
        $("#create").click(displayStory);

            function createStory(){


                var userName = $("#name").val();

                var strColor = $("#color").val();

                var strAnimal = $("#animal").val();

                var strLocation = $("#location").val();

                var strFood = $("#food").val();

                var strSnacks = $("#snacks").val();


                var strSound = $("#sound").val();



                var strEmail = $("#email").val();



                var strZipCode = $("#zip").val();


                var txt1=new String("Hello, my name is " + userName + ".  My favorite color is " + strColor + ". My most cherished animal " + strAnimal + " gave me great joy. It may interest you to know that " + strAnimal + " can survive in many places including " + strLocation + "  ");
                var txt2=new String("My favorite food is " + strFood + " and I just can not get enough of it.  I can have as many as " + strSnacks + " portion(s) for snacks everyday. A sound I love is " + strSound + " and you should really hear it.  ");
                var txt3=new String("I can honestly say that my favorite email address is " + strEmail + " and I would suggest that you write to them.  If I was to pick a state that I love to live in, I would have to say one with a zip code of " + strZipCode + " would be that State.  ");


                return $("#story").html(txt1 +" "+ txt2 +" "+ txt3);

            }



        $.validator.setDefaults({
        submitHandler: function() { alert("submitted!"); },
        highlight: function(input) {
            $(input).addClass("ui-state-highlight");
        },
        unhighlight: function(input) {
            $(input).removeClass("ui-state-highlight");
        }
    });


    $().ready(function() {


        // validate story form on keyup and submit
        $("#storyform").validate({

               rules: {
            name:   { required: true },
            color:  { required: true,
                      minlength: 3 },
            location:  { required: true },
            animal: { required: true },
            food:   { required: true },
            sound:  { required: true },
            snacks:  { required: true, 
                      digits:   true,
                      minlength: 2, 
                      maxlength: 2 },
            email:  { required: true, 
                      email:    true },
            zip:    { required: true, 
                      digits:   true, 
                      minlength: 5, 
                      maxlength: 5 }
        },

        // messages
        messages: {
            name:   { required:  "Your name is required" },
            color:  { required:  "Color name is required",
                      minlength: "Must be at least 3 characters" },
            location:  { required:  "Location is required" },
            animal: { required:  "Animal is required" },
            food:   { required:  "Food is required" },
            sound:  { required:  "Sound is required" },
            snacks:  { required:  "Snack is required", 
                      digits:    "Must be a number",
                      minlength: "Must be 2 characters", 
                      maxlength: "Must be 2 characters" },
            email:  { required:  "Valid email address is required", 
                      email:     "Must be an email address" },
            zip:    { required:  "Zip Code is required", 
                      digits:    "Must be a number", 
                      minlength: "Must be 5 characters", 
                      maxlength: "Must be 5 characters" }
        },

        });

        });


    });


            <form class="cmxform" id="storyform" method="get" action="">

<fieldset>
<label for="name">Name</label>
<input id="name" name="name" type="text" placeholder="First and last name" class="required"  autofocus/>
</fieldset>

<fieldset>
<label for="color">Color</label>
<input id="color" name="color" type="text" placeholder="enter a color" class="required"/>
</fieldset>

<fieldset>
<label for="location">Location</label>
<input id="location" name="location" type="text" placeholder="name a location"/>
</fieldset>

<fieldset>
<label for="animal">Animal</label>
<input id="animal" name="animal" type="text" placeholder="name an animal"/>
</fieldset>

<fieldset>
<label for="food">Food</label>
<input id="food" name="food" type="text" placeholder="name a food"/>
</fieldset>

<fieldset>
<label for="sound">Sound</label>
<input id="sound" name="sound" type="text" placeholder="name a sound"/>
</fieldset>

<fieldset>
<label for="snacks">Number of Snacks</label>
<input id="snacks" name="snacks" type="number" placeholder="# of snacks"/>
</fieldset>

<fieldset>
<label for="email">Email</label>
<input id="email" name="email" type="email" placeholder="example@domain.com"/>
</fieldset>

<fieldset>
<label for="zip">Zip Code</label>
<input id="zip" name="zip" type="number" placeholder="5 digit zip code"/>
</fieldset>

 <div>

 <p id="target"><br/><br/>

<label for="story"><strong>Here's Your Story</strong></label><br/>
<textarea id="story" name="story" rows="3"></textarea>
</p>
</div>

<fieldset>
<button id="create"class="submit" type="submit" onclick="displayStory()" value="Create">Create</button>
<button id="clear"class="reset" type="submit" onclick="hideStory()" value="Clear"/>Clear</button>
</fieldset>


</form>

                });
            </script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T06:46:42+00:00Added an answer on May 24, 2026 at 6:46 am

    Got it working here with a pretty basic script: http://jsfiddle.net/RTfMM/.

    Update: This will clear out all the fields within the form and replace their values with the placeholder text.

    $("#clear").click(function(){
        $('#storyform input[type="text"]').val("");
      });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this little script to toggle a contact form when a button is
I have this input in a form: <input type=text value=<script src='/js/script.js' type='text/javascript'></script> name=embed/> The
The script below resides in my theme's functions.php file. It is designed to show
my <fb:request-form> show incorrect size (width). here is my code: <fb:serverFbml style=width:600px;> <script type=text/fbml>
Is there a way to DRY this jQuery up? <script type=text/javascript> $('form input#search').watermark('search...'); </script>
I have this code below and want it to show the progress of a
I have this code below and want it to show the progress of a
I have a script that reads a form and puts some info into a
I have a cgi script which takes form input, I want to facilitate the
I'm trying to send data from a form to an external script prior to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.