[SOLVED] Preset a value in a blank form from a control

I created a control with a user and a password that redirect to a blank form. I want the user id to be passed to the form so that the user cannot change it.

So far, I have the global variable [v_user] that is verified in the control then passed to the form. It is set as a session variable and type out in the control and session type in, in the form.
I used Welcome [v_user] in the header to make sure the variable was passed on and it is the case.

The problem is that in the form, the user_id is still blank and I want to avoid the user to be able to enter another id.
I tried a where clause but since I want to perform an insert with the form and not a select, I think that is why it did not work, but I am still new to scriptcase and MySQL, so Iā€™m not sureā€¦

Also, I used sc_apl_conf(ā€œform_tempsā€, ā€œstartā€, ā€œnewā€); in onApplicationInit in the form, so I think it may be interfering with the global variable but Iā€™m not sure ???

Any help would be greatly appreciated.

Hi,
if your user_id is different from your [v_user] variable just pass it along as well.
Go to the settings page for the field and locate the line ā€˜Initial Value (type)ā€™ and set it to ā€˜Definded Valueā€™.
A new line ā€˜Initial Valueā€™ is shown where you enter your variable i.e. [v_user_id].
To make sure it canā€™t be changed by the user you can set the field to act as a label, set it to read only or even hide it if you want.

jsb

1 Like

It works!
Thank you very much for your help!