Update labels

L

Linda

I have 2 labels on a page...(weight, age). The user will click on the
label to set the focus on a label. There will be 10 buttons (0-9) on
the page. I want to update the label as the user clicks on the
buttons. Then the user should be able to move to the second label and
enter the numbers by using the buttons. I don't want this to be a
textarea or text but rather a label. How do I do this?

(Newbie to javascript).

Linda
 
D

David Mark

I have 2 labels on a page...(weight, age). The user will click on the
label to set the focus on a label.  There will be 10 buttons (0-9) on

To set the focus on an input?
the page.  I want to update the label as the user clicks on the
buttons.  Then the user should be able to move to the second label and
enter the numbers by using the buttons.  I don't want this to be a
textarea or text but rather a label. How do I do this?

You want a virtual numeric keypad?
(Newbie to javascript).

Okay, but it is unlikely that anyone is going to write it for you.

Google "onclick" to get started. Then read up on input elements,
specifically the value property. The solution should be apparent at
that point. If you can't make it work, post the code.
 
L

Linda

Okay, but it is unlikely that anyone is going to write it for you.

Don't worry about it. I have never and will never ask someone to
"write it for me" unless I want to pay for their work. Just a pointer
would have been helpful. There is a LOT of free javascript code out
there for calculators, etc. They just did not do exactly what I was
looking for.

If you want me to be more specific, when writing a few pages for a web
app for the iPhone, I wanted to find a way to prevent the automatic
keyboards from popping up. There is a numeric one that looks like a
phone pad and has the "ABCs" on it. That doesn't quite suit my
needs. There is an alphanumeric keypad and others that just don't
quite fit what I want to do. I was going to create my own buttons and
update a label with onclick events of these numeric buttons.
Previously, the way that the numeric keyboard was induced to pop up
was if you had an id of phone or zip. This is no longer the case. I
want the user to ONLY enter numbers into the form and I don't want the
automatic iPhone keyboards to pop up.

I will figure it out for myself and then I will share the information
with others on the iPhoneWebDev group. There have been several people
that have experienced a similar problem in that the wrong keyboard for
their needs responds. I will share this with others...unlike what you
were doing. Surely you have asked for help yourself in the past.

Linda
 
D

David Mark

Don't worry about it.  I have never and will never ask someone to
"write it for me" unless I want to pay for their work.  Just a pointer
would have been helpful.  There is a LOT of free javascript code out

I gave you a couple.
there for calculators, etc.  They just did not do exactly what I was
looking for.
Right.


If you want me to be more specific, when writing a few pages for a web
app for the iPhone, I wanted to find a way to prevent the automatic
keyboards from popping up.  There is a numeric one that looks like a
phone pad and has the "ABCs" on it.  That doesn't quite suit my
needs.  There is an alphanumeric keypad and others that just don't
quite fit what I want to do.  I was going to create my own buttons and
update a label with onclick events of these numeric buttons.

Not a label.
Previously, the way that the numeric keyboard was induced to pop up
was if you had an id of phone or zip.  This is no longer the case.  I
want the user to ONLY enter numbers into the form and I don't want the
automatic iPhone keyboards to pop up.

Um, okay.
I will figure it out for myself and then I will share the information
with others on the iPhoneWebDev group.  There have been several people
that have experienced a similar problem in that the wrong keyboard for
their needs responds. I will share this with others...unlike what you
were doing.

Gee, sorry. I did my best to help. I have forwarded your complaints
to the customer service manager. Thanks very much for stopping by.
Give my best to the iPhoneWebDev group (whatever that is.)
Surely you have asked for help yourself in the past.

No, I have never posted a question here. Well, maybe once and I
probably had my terminology straight and posted some code. You can
search the archives if you are interested.

Have a nice day! :)
 
L

Linda

OK. Trying again and I hope that I don't anger or frustrate the
professionals on this forum.

Is there any control that can be updated in real time with the use of
numbered buttons other than a text control? As the user clicks on a
button, this control will be updated.

I will have buttons for 0-9 and a decimal on a page. I want the user
to be able to enter numbers only and so will provide the buttons. For
example, the user would be entering age and weight. This is not a
calculator type of web app. It would have several controls that the
user would enter data into the page.

This will be for viewing on an iPhone and what I am trying to prevent
is the automatic pop-up of the iPhone keyboards if the user taps on
the control. If it is a text input control, the keyboard on the
iPhone automatically pops up. I don't want that. They automatic
keyboard covers too much screen space. So, is there another type of
control that can be edited using Javascript from clicking on the
buttons?

I have also tried a label but the keyboard pops up with this as well.

Is a div an option? Is a cell in a table possible? Some non-standard
control that I can re-use that someone else has created? Even if I
have to purchase the code for it? All that I am really looking for is
an idea. I am not looking for the code. I am not looking for someone
to write this for me unless it is already in common use or it is
available for purchase to re-use the code. I am not a parasite...only
looking for a suggestion from people that obviously know more about
javascript than I do.

Thanks,
Linda
 
D

David Mark

OK.  Trying again and I hope that I don't anger or frustrate the
professionals on this forum.

Is there any control that can be updated in real time with the use of
numbered buttons other than a text control? As the user clicks on a
button, this control will be updated.

You can update the text of any element. Google for "textContent" and
"innerText." Still, it would make sense to use a text input in this
case (set its value property.)
 
L

Linda

You can update the text of any element.  Google for "textContent" and
"innerText."

Thank you.
Still, it would make sense to use a text input in this
case (set its value property.

Afraid not. Even if it is not editable, that property is only
accessed after the keyboard pops up...which is what I want to prevent.

Linda
 
T

Thomas 'PointedEars' Lahn

Linda said:
Afraid not. Even if it is not editable, that property is only
accessed after the keyboard pops up...which is what I want to prevent.

You are not making sense. A text input *is* a control "that can be updated
in real time with the use of numbered buttons". And "as the user clicks on
a button, this control will be updated."

Please learn to quote: trim the parts that are not referred to, leave the
parts that are referred to, over several quotation levels if necessary.


PointedEars
 
S

SAM

Le 11/20/08 12:44 AM, Linda a écrit :
I have 2 labels on a page...(weight, age). The user will click on the
label to set the focus on a label. There will be 10 buttons (0-9) on
the page. I want to update the label as the user clicks on the
buttons. Then the user should be able to move to the second label and
enter the numbers by using the buttons. I don't want this to be a
textarea or text but rather a label. How do I do this?

What can be a label for you ?
To create and display a virtual numeric keyboard is not too much difficult.

I don't know the iPhone, and I don't use internet on my mobile, but it
seems to me that my children use their phones to send SMS ? I think they
have a kind of autosuggestion when writing but not a popup keyboard.

If the question is how to abort the iPhone's keyboard popup, I don't know.

If the question is how to set a tag reacting to a click, here it is :

<tag onclick="numKeyBd(this);">age: <span></span></tag>


function numKeyBd(what) {
var k = document.getElementById('numKeyBoard');
k.label = what.getElementsByTagName('span')[0];
what.parentNode.appendChild(k);
k.style.display = 'block';
}

Then you create a DIV idded 'numKeyBoard' with your 12 buttons
(don't forget the backspace)

<button value="9" onclick="return entree(this);">9</button>
....
<br>
<button value="0" onclick="return entree(this);">0</button>
<button value="." onclick="return entree(this);">.</button>
<button onclick="return delLastEnter();">&lt;</button>
<br>
<a href="javascript:closeKB();">close</a>
</div>


function entree(quoi) {
var c = document.getElementById('numKeyBoard').label;
c.innerHTML += quoi.value;
return false;
}

function closeKB() {
document.getElementById('numKeyBoard').style.display = 'none';
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top