Any reason why form.clear() & form.reset() do nothing?

Could there be any reason why both
form.clear() & form.reset() do absolutely nothing?

There is no error displayed in Firebug, so I suppose that script is properly executed but the form fields aren’t cleared.


will set values of form back to previosly loaded ones, or to default values. If you not using data loading , and default values was not define - command will not have any visible effect.

as for form.clear() - it must set empty values for all inputs, and works correctly locally.

Try to use the latest version with all fixes up to date ( attached )

If issue still occurs for you - please provide any kind of sample or demo link where it can be reconstructed. (13.6 KB)

I found where the problem is, it doesn’t work if form is initialized from ready made HTML form.

When I try to “clear” an XML initialized form then it works fine.

I will try the file you uploaded and let you know. (966 Bytes)

Same behavior as before even with the update you provided.

Problem still is when form is initialized from HTML. You can see it happen in the file I uploaded in my previous post.

I upload in this post the same example but using the dhtmlxform.js you provided. (972 Bytes)

Problem confirmed, currently form initialized from HTML ignores clear command.
We will check, how it can be fixed.

Are there any updates on the issue?

Dataprocessor seems to ignore changes in the form if it’s “cleared” manually. Is there any way to “force” dataprocessor to believe that we have made changes to the form and make it send data to server ?

form.resetDataProcessor("updated") dp.sendData();

Thanks a lot,
that seems to do the job but after trying to update I get an empty “alert” window and action:error in logfile but is empty:

id => 7
code => 7
isactive => 1
pname => Bugs
mname => Disney
psurname => Bunny
birthdate => 1900-01-01
!nativeeditor_status => updated

Edit operation finished
0 => action:error; sid:7; tid:7;

Done in 0.0048799514770508s

I have done the changes you suggested in : viewtopic.php?f=19&t=15787 in order to show mysql_errors to client and it works nicely in grids but not in my form.

Is there any way I can also send to logfile the UPDATE sql command issued by connector/dataprocessor?

I enabled the general_log option in MySQL and noticed that load operation on form correctly issues a SELECT statement but after senddata there is no UPDATE statement sent to MySQL.

If issue still occurs - please provide full text of log file and file of form connector, which you are using.

It did, but in order to solve it I made a custom update function like this:


And it works fine now.

How do you specify a default value in DHTMLX on a basic form element?

I cannot find it in the API: … alpha_form

form.clear() clears everything as expected, but form.reset() does nothing.

I meant to quote Stanislav saying:

form reset works if data was loaded by form.load command.
It will not have any visible effect if data was not loaded in the form previosly.

Ah I see, thanks.