• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to pass hidden parameter when changing the content of a textbox

 
Ranch Hand
Posts: 58
Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to have a textbox with some text and when the user change the value of it to pass a hidden parameter to the form after submitting the form.How can I do that?

<input type="text" name="" value="abcde" onChange="???"/>

I have try it with javascript when change to call a function and set one variable to true and pass it to a the form as hidden but it doesn't work.

Thanks
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Saying " I wrote some code that doesn't work" doesn't help us help you get it working.
 
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you mean you want to create a new input of type "hidden" dynamically and append it to the form?

or just always have a hidden input in the form and update the text as the user changes the text in a textbox?

Justin Fox
 
naro pad
Ranch Hand
Posts: 58
Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Basically what I have is a form where I fill out all the textbox reading from database. I want if the user change something in the content of the textbox to pass hidden parameters in order to notify that something has been change and to save the new values. If not change, a parameter will pass as empty and I will not doing anything.

I don't know if I'm doing it with the wrong way,you can suggest me with a right one or you can see mine:
-this code is from top to down-


My Javascript is below the form:


The problem is that I run a debug mode and I saw that if I change only the aim textarea value both parameters are set to true and both executed.Why is that?

I don't know if I'm providing a helpful code

[ June 07, 2008: Message edited by: panayiotis panayiotou ]
[ June 07, 2008: Message edited by: panayiotis panayiotou ]
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by panayiotis panayiotou:
The problem is that if I pass only the editSyllabus parameter on my requests on the top, editSubjInfo parameter is also executed although I'm not changing nothing.


I'm still not sure what the problem is because parameters are not "executed" so I don;t know what you mean by that.

But that said, i think I see what you are trying to do. You want a separate parameter that lets you know if another has been changed.

The code you wrote for this seems vastly and needlessly complex. All you need to do is to adjust the value of the corresponding hidden parameter. There's really no need for all the variable and separate functions, that can be done in a single statement.

Consider:


And then do the same for the other value.
[ June 07, 2008: Message edited by: Bear Bibeault ]
 
naro pad
Ranch Hand
Posts: 58
Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bear Bibeault, is working perfect...I suppose I was trying to do it with the hard way.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Learning how not to over-engineer a solution is part of progressing, so no need to feel badly.
 
reply
    Bookmark Topic Watch Topic
  • New Topic