hidden values to a textbox?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kabucek
Forum Commoner
Posts: 50
Joined: Thu Sep 04, 2008 2:20 pm

hidden values to a textbox?

Post by kabucek »

hi
can we setup hidden values to textbox?

like options for select?

thanks
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Re: hidden values to a textbox?

Post by Burrito »

dont' fully understand your question...

text boxes display content entered into them. Are you trying to hide information entered into a text box and save it off in a hidden var somewhere?

If so, you could probably do something like this on a key down event of a textbox.

Code: Select all

 
<script>
function hideText(obj)
{
   hiddenField = document.getElementById("myHiddenField");
   hiddenField.value += obj.value;
   obj.value = "";
}
</script>
 
watson516
Forum Contributor
Posts: 198
Joined: Mon Mar 20, 2006 9:19 pm
Location: Hamilton, Ontario

Re: hidden values to a textbox?

Post by watson516 »

kabucek wrote:hi
can we setup hidden values to textbox?

like options for select?

thanks
First off, options for select aren't hidden. They are the things that actually get shown.

You could use a hidden field

Code: Select all

<form action="#" method="POST">
    <input type="text" name="textBox" />
    <input type="hidden" name="hiddenName" value="someValue" />
    <input type="submit" value="Submit" />
</form>
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: hidden values to a textbox?

Post by califdon »

kabucek wrote:hi
can we setup hidden values to textbox?

like options for select?

thanks
What are you trying to do?
kabucek
Forum Commoner
Posts: 50
Joined: Thu Sep 04, 2008 2:20 pm

Re: hidden values to a textbox?

Post by kabucek »

Can this have 3 values?

watson516 wrote:
kabucek wrote:hi


First off, options for select aren't hidden. They are the things that actually get shown.

You could use a hidden field

Code: Select all

<form action="#" method="POST">
    <input type="text" name="textBox" />
    <input type="hidden" name="hiddenName" value="someValue" />
    <input type="submit" value="Submit" />
</form>
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Re: hidden values to a textbox?

Post by Burrito »

you could use a delimiter and give it as many values as you want. Or you could just create multiple hidden fields.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: hidden values to a textbox?

Post by califdon »

You will receive much more useful advice if you will tell us what you are trying to achieve, instead of asking questions about what can or can't be done. Most of the time when questions like yours are asked, the correct solution is entirely different from what the person is asking, which is why they are having trouble in the first place. Tell us what you need to do and we will surely explain how to do it.
kabucek
Forum Commoner
Posts: 50
Joined: Thu Sep 04, 2008 2:20 pm

Re: hidden values to a textbox?

Post by kabucek »

i want text box where people will be typing dates, for ex.
Jan 2, Mar 9, etc

if Jan 2 is typed, code will check if it is one of the hidden values:

"event1"= Jan 2
"event2"=Jul 3, etc

if its Jan 2 then it will catch the event1 value


Thanks !
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: hidden values to a textbox?

Post by onion2k »

Either explain what you want help with in a clear way without any shorthand or assumed knowledge, or I'm going to lock this thread. You aren't giving anywhere near enough detail.
kabucek
Forum Commoner
Posts: 50
Joined: Thu Sep 04, 2008 2:20 pm

Re: hidden values to a textbox?

Post by kabucek »

hmm ok..

we had dropdown with 3 options
1-event1
2-event2
3-event3

but people now want textbox instead of the dropdown with the same functionality.
How can I explain this more?
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: hidden values to a textbox?

Post by califdon »

Let me give this one more try. Kabucek, we are not trying to be unfriendly. You are frustrating us because we don't understand what you are trying to do. The reason any of us spend our time trying to answer other people's problems is that we like to share the experience and skills that we have been lucky enough to acquire. When a questioner only asks a narrow question and we can't see what purpose they are trying to achieve, we are unable to apply that experience and skill to the problem.

Instead of focusing on "hidden values" of a text box (whatever you may mean by that), what we are asking is that you tell us what situation you are trying to solve. You came a little closer with your latest post. What we would like to understand is WHAT you need to do, not HOW you are trying to do it. That's why you posted here in the first place, because you don't know HOW to do it. We would love to help you, but we can't until you explain what problem you are trying to solve. You said you wanted the "same functionality" but you still haven't told us what functionality that is.

Again I will say that most of the time, when someone asks a question like yours, the problem is not what they think it is, the problem is that they are trying to do the wrong thing, to begin with. We can help them, but only if they will explain WHAT THEY ARE TRYING TO ACHIEVE.
kabucek
Forum Commoner
Posts: 50
Joined: Thu Sep 04, 2008 2:20 pm

Re: hidden values to a textbox?

Post by kabucek »

ok,

I fully understand you,
but people above me like to make things complicated, sometimes too much.

We had dropdown box with events:

Code: Select all

 
 <select name='selectedProd'>
 
 <option  value='abcd1'>day 1 february 3</option>
 
 <option  value='bdce1 '>day 2</option>
 
 <option  value=edgr3'>day 3</option>
 
  <option  value='ruter1'>day 4</option>
                 
  <option  value='hoho2'>day 5</option>
 </select>
Everyone is scratching their heads what is wrong with that?
Well, they don't want drop-down any more, they want customers to type in:
day 1 february 3
in the box, and when they do that it will do the same thing as the dropdown.

Now, I'm thinking this might have functionality like "login box"
or my another question would be:
- does textbox can have "options" or many values assigned already?

I'm thinking about functions maybe or some loops that will be checking input of the textbox:

if textbox[event] == "day 1 february 3"
{
textbox[event] ='abcd1'
}

and I know this will be forcing to change the value of the input,
but now sure if there is other way to do it if they really want to stuck with textbox instead of dropdown.

I'm looking also in login box code,
this might a little better.
If you need more information,
I will try to explain as much as I can.

Thanks!!
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: hidden values to a textbox?

Post by califdon »

I will try to give you some answers, but you have still not explained what your problem is. What I was looking for is WHAT YOUR PURPOSE IS, not what you think the SOLUTION might be. I have given up on asking you, but at least let me try to be of some help to you:

An HTML <input type='text' element is just a place where the user can enter some text. Nothing else. It is nothing remotely like a <select element with <option>s. If you want a user to select from choices, the only possibilities are <options> or <input type='radio' elements.

I have no idea what you are referring to when you write textbox[event] = 'abcd1'. The value of a textbox, or of any other HTML element has nothing to do with any "events".

If your job is to design web pages, you need to have the level of knowledge to do that job, and if "people" are telling you how to do the job in the detail you describe, you need to tell them that your knowledge is greater than theirs in this area (if this is true) and that they must leave the decision to you. If the "people" are your bosses, you have a serious problem, since they apparently don't respect your level of knowledge. I'm sorry, but that's a problem we can't help you with.
Post Reply