Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderator: ArturoRobles

Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
By Somayeh
#829493
Hi guys. i want to hide and show part of my form. so i tried this code, but it did not work. how can i solve it?



-------------------

this code for show and hide part of form by a checkBox:

function HideFields() {
if (getField("checkboxVar001").checked)
contractSubtitle("subtitle0000000001");
else //if not checked
expandSubtitle("subtitle0000000001");
}
getField("checkboxVar001").onchange = HideFields; //execute when checkbox changes
HideFields(); //execute when DynaForm loads
User avatar
By kirkwg
#829494
Hi there,

If you are new to programming or Processmaker, kindly read processmaker online wiki/docs, otherwise hardly to proceed.
https://wiki.processmaker.com/3.2/JavaScript_Functions_and_Methods/Controls

Refer to above link and search more relevant links please.
    getField() was old for v2.x, try using processmaker v3.x JS functions
    Use jQuery syntax is much better for beginner, i.e. $("#field_id"). with proper function..
    $("#field_id"). hide(); //hide a field
    $("#field_id"). show(); //show a field
Attached a picture see an example, wish it helps, thanks.
Attachments
3-2-3-5-JavaScript-Functions-and-Methods-Controls-Documentation-ProcessMaker.png
3-2-3-5-JavaScript-Functions-and-Methods-Controls-Documentation-ProcessMaker.png (65.24 KiB) Viewed 242 times
By alisoroush7
#829504
Somayeh wrote: Wed Sep 08, 2021 3:49 am Hi guys. i want to hide and show part of my form. so i tried this code, but it did not work. how can i solve it?



-------------------

this code for show and hide part of form by a checkBox:

function HideFields() {
if (getField("checkboxVar001").checked)
contractSubtitle("subtitle0000000001");
else //if not checked
expandSubtitle("subtitle0000000001");
}
getField("checkboxVar001").onchange = HideFields; //execute when checkbox changes
HideFields(); //execute when DynaForm loads
i think you can easily do this by using setonchange statement

It looks like there is a bug there in Processmaker[…]

In today's world of non stop spam messages it is b[…]

The Hostnetindia provides best and Cheap]Linux [/c[…]

Thank you so much for you help kirkwg!