0

I am using redQueryBuilder. It uses gwt for rendering the textbox elements. I want to change the value of textbox on focus of the element. I am trying the following code.

$(".gwt-TextBox").val("something");

I can the see the value in ui, but when submitting the form the value of the field is empty. Why is it so? Am I missing something big here?

Here is the html code which gets generated by redQueryBuilder.

<div><input type="text" class="gwt-TextBox ui-autocomplete-input" autocomplete="off"></div>
Ratnesh
  • 1
  • 4
  • Can you show us your html code? – Mivaweb Jun 30 '15 at 06:51
  • Odd. http://redquerybuilder.appspot.com if I open "large cities in the uk and oxford" inspecting the number element doesn't show a value attribute. – salk31 Jun 30 '15 at 15:49
  • Would you be interested in https://github.com/salk31/RedQueryBuilder/blob/tardis/redquerybuilder-core/src/main/java/com/redspr/redquerybuilder/core/client/expression/CustomEditorWidget.java which would allow you to use your own widget and control it totally? Not in a release yet but I could pull it from the branch. – salk31 Jun 30 '15 at 15:54

1 Answers1

0

In the JSNI, call like this

$win.$(".gwt-TextBox").val("something");

Suggestion, do not use class name to access as it will change and set the same value to all the elements which has same class unless that is you use case. To change the value of one element, access it by its id.

<div><input type="text" class="gwt-TextBox ui-autocomplete-input" autocomplete="off" id="someId"></div> 

$win.$("#someId").val("something");
Abhijith Nagaraja
  • 3,370
  • 6
  • 27
  • 55