Unable to get values from HTML to Client script in UI Page

Dhanakoddi2
Tera Contributor

Hello,

 

I am creating a UI page with a textbox, but I am unable to get the value given in the textbox on click of submit button.

 

This is HTML part

 

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">    
<g:ui_form>
    <div class="row">
        <span style="padding:16px; font-weight:bold;">Enter Google Document ID </span>
    </div>
    <div class="row">
        <textarea id="importArticlesID" name="importArticlesID" class="form-control" spellcheck="true" style="float: left; margin-left: 16px; width: 600px; height: 30px; border: 2px solid #000000; padding: 2px; overflow: hidden; word-wrap: break-word; resize: none;" required="required" type="text"> </textarea>                
    </div>
    <br></br>
    <div class="modal-footer" style="padding:16px;">
    <span class="pull-right">
        <button class="btn btn-default" onclick="return onCancel()" style="float: left; margin-right:20px; min-width: 5em;" title="" type="submit">Cancel</button>
        <button class="btn btn-primary" onclick="return importArticle()" style="float: left; margin-right:20px; min-width: 5em;" title="" type="submit">Import</button>    
    </span>
    </div>  
</g:ui_form>
</j:jelly>
 
This is Client Script part
function importArticle() {
   var textArea = $("importArticlesID");
   alert('Text : ' + textArea);
   var id = textArea.value.trim();
   alert('Value: ' + id);
  GlideDialogWindow.get().destroy();
}
function onCancel() {
    GlideDialogWindow.get().destroy();
    return false;
}
 
Could anyone help me to get the value of the textbox?
Thanks!
7 REPLIES 7

kkrushkov
Mega Sage

Hello @Dhanakoddi2,

I tested your code, and it functions as intended. Is that what you anticipate?

kkrushkov_0-1711526458480.png

 

Hello Krush,

 

I have created a module with URL (from Arguments:) and have given the endpoint of the UI page.

Dhanakoddi2_0-1711554377471.png

After clicking the module if I enter text then I am not getting any alert. Could you please suggest anything here how we can achieve this from module?

I followed the exact steps as you (created a module with URL), and it works. Is that what you were expecting?

kkrushkov_0-1711607452236.png

 

Yes Krush,

Actually my requirement is when I enter any Google Document ID in the text box it should automatically create a knowledge article with the content from the google document.

 

So I have created Flow designer and integrated with Google. Now I want to pass the textbox value to the flow designer input.

That's why I want to get the value from the text box and store it into the variable in client script. I wanted to check it is getting correct value or not by alerting that value. 

 

But for me it is not working. My instance version is Utah.