Changing the value of a textbox using JavaScript snippet

1
Hi All, I tried to change the value of a textbox on a button click using javascript snippet, I’m able to place the string in the text box, but not as a value. It is populating like a place holder, when i click the textbox it disappear.   code used:-     $(document).ready(function(){                         $(".ButtonClass").click(function(){                              var text= 'Name';                             $(".myclass :input").val(text);  //('myclass' textbox class name)                         });                         }); also tried :- $('.myclass').val(text);   (Not working) Please help me to do this. Thanks in Advance
asked
2 answers
0

A bit over the top perhaps, but this is a mendix training creating a widget doing just that:

https://docs.mendix.com/howto/extensibility/create-a-pluggable-widget-one and

https://docs.mendix.com/howto/extensibility/create-a-pluggable-widget-two

 

answered
0

Hey Krishnan,

No need to use JQuery or any code for this:

  • create the input field, and make sure it is linked to an attribute, and that the input field is contained in a dataview that has an actual object (e.g. a DS)
  • create a button underneath the field and
    • Add a nanoflow action. In the Nanoflow, set the content of the attribute, and that's it.
    • Obviously make sure all access rights are set.

Really no need to use JQuery or JavaScript.

Best regards,

Wouter

answered