PDA

View Full Version : Field getting emptied without me asking...



pwiegers
20 May 2010, 8:39 PM
Hi Guys/Gals,

I'm having a serious issue at the moment with a form which loses values - from the id field, to be exact...!
Let me try to explain...
I have a application with a tabarea inside. In one of these tabs there is a form. This holds the person-data (name etc.). This loads the data fine. In a other tab I have a grid (this load all the contact-events with this person). Loads fine too.
Now, there is a button that lets you create a new contactevent. If you press this, sometimes (not allways....) the id-field of the form with the person data will be deleted! At first, it was of course a hidden field, and I could not figure out what happened, but now I have made it a normal textfield, and I can acutally see it happend!

The code that makes a new contactevent is very simple:

function addContact()
{
showContact();
foContact.getForm().reset();
}
showContact() does not do anything more than hide the div that contains the grid and show the contact-event form. But when I press addContact, the field 'id' in the person-form is being deleted!

I can't figure out why this would happen. Anybody got any idea's?

thanks very much for any input....

greetings

Paul

evant
20 May 2010, 8:44 PM
You're calling reset on the form, which means the value will be reset to the initial value.

pwiegers
20 May 2010, 9:15 PM
Dear Ivan,

thanks for your reply. But the form that I reset is the form that I wish to be displayed - and that is not the form that is loosing the value of the id field.
There are two (actually more) forms in play, and the one that looses the value of the id (not the other values!) is not the one I reset...

Thanks for your time!

Paul

Animal
20 May 2010, 9:19 PM
What debugging have you done?

pwiegers
20 May 2010, 9:25 PM
Hi Animal,

well, the point is that I cannot figure out what to debug...
The button I press does not more than the code you see above. Before I press it, there is a value in the ID-field of formA. When I press the button, I reset formB. But at the same time (or for me not distinguishable time) the value of the other field goes... I do not know how to debug this, as I can't tell where it happens...

greetings,
Paul

Animal
20 May 2010, 9:35 PM
Come on!

It clears when you press a button? Which runs a handler function?

Then set a break in the handler function and step through all executed code until you find the statement that clears the field!

That's what we DO.

pwiegers
27 May 2010, 9:37 AM
With some help, I figured it out: you can't have more fields with the same id - even if they are on multiple forms! I thought that it would not matter as long as you had multiple forms, but I was wrong. I've renamed the fields, and the problem is gone...

Thanks everybody for their help!

Paul