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 7503797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:21:19+00:00 2026-05-29T21:21:19+00:00

function show_prompt() { var name=prompt(Please enter your name); } I am calling this function

  • 0
function show_prompt()
{
var name=prompt("Please enter your name");

}

I am calling this function when a button is clicked before submitting the form.

How would I post the ‘name’ var with form so I can use it with php?

Also, would it be possible to verify the user input before letting it to be submitted? For example to make sure it’s at least 4 characters? The user should not be able to click the button before the input meets the criteria. I’m guessing that is not possible, at least with the alert() function. Or could it display another alert message if the input is invalid and re-prompt?

  • 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-29T21:21:21+00:00Added an answer on May 29, 2026 at 9:21 pm
    function show_prompt() {
        var name;
        do {
            name=prompt("Please enter your name");
        }
        while(name.length < 4);
        $('#myinput').val(name);
    }
    

    This will prompt until a name with at least 4 chars is found and will afterwards write it into the Input with the ID myinput.

    Demo: http://jsfiddle.net/xy829/ (The input of course can be hidden as well)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have embedded the fullcalendar jquery control by using this code: $(document).ready(function() { var
Firstly, here is my code: Ext.Msg.show({ title: 'Username', msg: 'Please enter your username', buttons:
I use the following function to show controls on my form: class procedure TFormMain.FadeControls(ctrl:Array
I'm trying to use a sound callback function to show a button once my
I'll show you the function first. private var areaCollection:ArrayCollection; private function generateAreaCollection():void { areaCollection
I have a form with some text-inputs: login, password. If user sees this form
I am trying to have a dynamic prompt from my elisp function. I want
In the Windows Explorer there is a function 'command-prompt-here' that opens a command prompt
Can someone please help me with compiling gtk+ (& gtkmm) at Vista cmd prompt?
I have this function (going trough the Eloquent Javascript Tutorial chapter 3): function absolute(number)

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.