Jump to content

Automatically update textbox?


Roy766

Recommended Posts

Yes, this will need javascript. Basically have a function that you can call and when input is made(onkeypress or whatever), you call the function with the current input field's properties, and then to your comparisons or whatever. Then, say, if your textarea you want updated has a name="txt" in a form name="form1", then you'd do document.form1.txt.value='value goes here';

 

that's the gist of it

I'm pretty sure I already showed him how to do it.

 

Also making a function and using form names as objects is much bulkier then my solution.

 

You only have 8 posts here. So you obviously haven't experienced where you give someone a clean-cut, simple answer and they manage to have trouble with it. There's nothing "bulky" about my response. Yea, if you're including several js files that are huge then it'd be bad, but when it comes to basic js, performance isnt even a nanosecond slower than your code. And if he wants to do further calcuation or comparison of the input, you really think it's better(and cleaner) to put it all within the quotes after the event handler(onchange)? How about no.

 

Plus, your code doesn't do what he asks. He asks for the textbox to update as input is typed. Your example gives the change after leaving the current input field. The correct one would be onkeyup instead of onchange

1.How would I know the old experienced vs. non-experienced forum member argument would be pulled? *sigh*

 

2.Anyway, I am a paid moderator at other php help forum sites, so I think I know how to deal with answering questions.

 

3.Your code is not "bulky", it's "bulkier".  ;)

 

4.Lastly, I am sorry Roy766 that you had to see this argument in a thread about you, but if you want other textboxes to change in realtime, yes use onkeydown/onkeypress etc.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.