PDA

View Full Version : a big problem with form.field



adnoh
15 Jan 2008, 7:19 AM
Hy everyone.

I've a big problem with some form fields.
I'm developing a webbased mailclient and I have a dialog with some inputboxes for entering
the recipients and under them a htmleditor for the message body.
Now my Problems.

I'm implementing currently the "reply" function where the dialog described above is filled with the original mails values (field.setValue(....))
then when running my application if I delete the entered text and submit this form I notice
that field.getValue() and field.getRawValue() is different !! (getValue returns the original set value - that with setValue) only getRawValue() hold the right value of the field.

the next problem is that I have a "onBlur" listener on the fields to do a

if (field.getRawValue() != field.getValue()){
field.setValue(field.getRawValue());
}
for the problem described above. But this function is NOT called if I click from a Inputfield into the htmleditor ! So the field doesn't loose its focus!? If I click from one field into a other or using the TAB key it works well ...Hopefully somebody can explain me why or what I'm doing wrong. I'm really being confused... the resulting email is not what my form looked like.... :((

RWaters
15 Jan 2008, 5:26 PM
What happens if you try setRawValue instead of setValue?

adnoh
15 Jan 2008, 11:39 PM
... then it seems to work .... damn ... somethimes I don't see the wood for trees ...
But why? When should I use set/getValue() and when set/getRawValue() !?
I thought the difference between them is that setRawValue() only skips validation !?

:-? ... and my onBlur event? Why doesn't that get fired when klicking from a input field to a html-editor?

adnoh
16 Jan 2008, 3:49 AM
nop .... it didn't work ... I've done it this way now, which works for me:


myForm.on('beforeaction', function(form, action){
Ext.each(form.items.items, function(item){
if (item.getRawValue() != item.getValue()){
item.setValue(item.getRawValue());
}
});
});
but whats with on('blur') ??? not being fired ....

RWaters
16 Jan 2008, 7:13 AM
blur is only fired when the input leaves the text field. If you click into another field it will certainly fire. Clicking a button may not directly move focus out of the field, so the blur event will not fire.

adnoh
17 Jan 2008, 4:34 AM
thanks. but what's with the html-editor - does this widget not get a focus and the input field leaves it in that moment?

And what is the difference between setValue() & setRawValue() from form.fields?

Thanks for your Patience :D