Get Field value from jQuery onLoad

Hi,

I’m trying to create a process in BonitaSoft that on one form load some data from a MySql database using an script on JQuery. I created a HTML Widget with the next code

It “should” get the form field “dfDispID” value and send it to myUrl.php and set the response into the field dfField2.value (plain text).

But… it doesnt work.

I tried with an alert ($(“#dfDispID”).val():wink: on document load and i get a “undefined”. I cant reach the field from Firefox

Note: My field has set in General > Options the HTML attribute id=‘dfINFO_TipoDispositivo’

Any help?

Thanks

Hi,

at first there seems to be a couple of issues with your script.

I had some working examples of what you are trying to achieve. Might help.
https://jsfiddle.net/jasdompa/1/
https://jsfiddle.net/jasdompa/2/

Vincent

Sorry, i modified the script a bit cause it some variables was in spanish and i screwed it up a bit.

I find the solution while i was taking some screenshots to give more info of my problem. Inspecting a bit the code i found that my field is inside a iframe id=“bonitaframe” and i cant reach it directly, need to use iframe.contents() to get it.

$("#bonitaframe").contents().find("#dfINFO_TipoDispositivo").val() worked like a charm

Thanks!!!