Java input box and

Posted on 2004-10-29
Last Modified: 2008-01-09
Should be easy or so I've been told..  : )

What I'm looking for is...

I have an  button on a page, I want a popup input box to show when the button is pressed
and the ablity to read the users inout into my code... ie: (vb example)
Dim mystring as string = inputbox("enter some text")

now I want to be able to work with "mystring" in the code.

Question by:flosoft
    LVL 11

    Expert Comment

    add this to your page_load

    assuming you have a aspbutton which will postback the form and is named button1
    button1.AddAttribute("onclick","hdnctrl.value=prompt('enter some text','default value');")

    assuming you have a hidden control called hdnctrl

    now the button click event should be able to access hdnctrl's value as the user entered input

    easy right?

    Have Fun

    Author Comment

    where do I put that code?... the asp button also has an onclick event in the .vb file...

    hopefully ez...
    LVL 11

    Accepted Solution

    button1.AddAttribute("onclick","hdnctrl.value=prompt('enter some text','default value');")

    will go in your page_load
    LVL 3

    Expert Comment

    Either what pratap_r said, or you could have a hidden layer on your html with the code, then display when the button is clicked..

    Author Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: MongoDB Object-Document Mapper for NodeJS

    NodeJS (JavaScript on the server) is awesome, but some developers get confused about NoSQL when it comes to working in Node with MongoDB (NoSQL database). Do you need a better explanation of how to use Node.js with MongoDB? The most popular choice is the Mongoose library.

    Suggested Solutions

    This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
    A short article about problems I had with the new location API and permissions in Marshmallow
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    856 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now