Jelly scripting

surya123
Mega Guru

Hi All,

I have a textbox in portal. The user will input the value in textbox and click on Submit.

On Submit, I want to write a jelly script so that it compares the data input by user in textbox with the data base table to see if it matches and if so, it returns a field value.

Eg : If a user enters k001 in the textbox in portal, the script should match this k001 with the list of records in table xyz and if it finds a match it outputs a fields (abc) value.

Thanks in advance

surya

6 REPLIES 6

timmyweytjens
Tera Expert

if you want to redirect the user to the record in the table you can do something like:


onclick="var theName = document.getElementById('name').value; location.href='nav_to.do?uri=xyz.do?sysparm_query=name='+theName"



if you want just to show a value you can do


<?xml version="1.0" encoding="utf-8" ?>


<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">


<script>


        findTheName(){


                // Put your GlideAjax code here to get the result of the table query


        }


</script>


  <input id="name" spellcheck="false"


maxlength="32" style="direction:ltr; " name="name"


onchange="onChange('name');"


  value="${name}" class="form-control" autocomplete="off" type="text" />


   


  <button class="button" style="vertical-align:middle;font-weight:bold;color:black" onclick="findTheName();" type="button"><span>Submit</span></button>


</j:jelly>


Hi


I was able to achieve this by fetching the value passed into parameter and retrieving it using the glide.



Thanks