How to get the value of what is written in a form and not on the table

F_bio Santos
Kilo Sage

Hi everyone, Im using the "form" widget, where I have a "message" field and a "resolve" button.

What is happening:

When I click resolve it looks at the value of the "message" field in the table and it's not empty, the state goes to "Closed Completed".

What Im trying to do:

When I click resolve it looks at what is written in the "message" field and not on the table, and if it is empty we get an infoMessage "Message is empty" and if it not empty the state moves to "Closed Completed".


The problem is that I dont know the code to get what's written on the field instead of what is in the table ...

Can anyone help with this ?

Image of the portal:

F_bioSantos_0-1698242604346.png

 



6 REPLIES 6

Samaksh Wani
Giga Sage
Giga Sage

Hello @F_bio Santos 

 

g_form.getValue('message');

 

and check whether it is empty or not.

 

it should be written on the UI Action.

 

Plz mark my solution as Accept, If you find it helpful.

 

Regards,

Samaksh

The problem with this is that it gets what's on the table @Samaksh Wani I want something that get's what the using is writing

Aniket Bhanse
Tera Guru

Here is the catch:

 

For the HTML fields, the text generally is considered as "paragraph" therefore your text is read as "<p>yourText</p>"

Check this onLoad script:

 

   //Type appropriate comment here, and begin script below
   var abc = g_form.getValue("u_html_1");
   g_form.addInfoMessage("abc");
   if (abc == "<p>AniketBhanse</p>") {
	g_form.addInfoMessage("true");
   }
   else {
	alert("false");
   }

 

This script returns "true" even when the text written on the form is "AniketBhanse"

AniketBhanse_0-1698314633389.png


In your case, you will have to adjust your script in such a way that the script is considering the HTML tags as well (like paragraph, heading-1,heading-2 etc)

Please mark it as correct or check if it helps.

@F_bio Santos 

if your issue is resolved from the above script, please mark an answer Correct. This way the thread will be closed and it will help other users too. 


Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!