- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2015 07:04 AM
Hello, I dont know how to set variable value to UI macro.
I have UI macro below and onchange client script
Onchange client script is able to alert me with variable, but I doesnt need alert, need to set this value to UI macro on form. So when user select value in field A, html data should be populated to field B ( field B is UI macro )
How can I do it ? Should I better create some UI page and pass data through ?
Actually I will need to pass html value to UI macro field through onchange wizard script.
thank you
/Petr
UI macro
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<html>
<head>
<script>
function checkDetails()
{
var selected_training = g_form.getReference('u_select_training');
var u_selected_training_description = selected_training.short_description;
alert('from date :'+u_selected_training_description);
}
</script>
</head>
</html>
</j:jelly>
Wizard Client Script
function onChange(control, oldValue, newValue, isLoading) {
if (!isLoading){
checkDetails();
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2015 09:46 AM
If I understand it right, it's fairly easy.
This is what I understood so far:
- You want to set a HTML field on the UI Macro with the Short_Description of the select training field on the form.
- One thing that's missing is the HTML of the field in the UI Macro.
Here is very small snippet I have set up:
My UI Macro has a field called "short description" which is an input, which I will be setting on Change of a field on the form. Here is the UI Macro. Notice the Script that's inside the UI Macro:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
Short Description: <input id="short_description" type="text"/>
<script>
function setDesc(text){
$j("#short_description").val(text);
}
</script>
</j:jelly>
Now, the easy part : write an onChange script to call the setDesc. Because `setDesc` is loaded on the global name space you should be able to call it like this:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
setDesc(newValue);
//Type appropriate comment here, and begin script below
}
Does that help?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2015 10:46 PM
If you are just trying to pass information from one field to the next what you could do is modify the calculated value on the second field to automatically populate the data.
Right-click field you want populated > Dictionary Item > Advanced View (Blue Link) > Calculated Value (Tab) > Calculated (Tick the box) > Calculation (current.nameOfReferenceField.nameOfFieldWithinReference.getDisplayValue())
So in an example where I want to populate the Caller ID's location into a blank field on the form the calculation would be -
current.caller_id.location.getDisplayValue()
This does however make the field automatically read-only, your other option would be a GetValue SetValue script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2015 11:06 PM
Hello and thank you, but I guess it doesnt work for variables ? I work with variable here and not with field on form
There is not advanced view for variables and I cannot get to Calculated Value (Tab)
is this right ?
/Petr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2015 11:12 PM
I was able to setvalue from reference field to UI macro field. However I doesnt have enough knowledge how to set html value from reference field through this solution.
Reference field have on referenced table html field called "description" and content of this should be displayed in macro instead of sys_id from reference field
Any advise please
/Petr
This is what I get, it is sys id from reference field, but I need populate html data from reference field
Below needs to be populated in UI macro from refrence field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2015 11:39 PM
You just need a little change in onchange script
var selected_training = g_form.getReference('u_select_training');
var u_selected_training_description = selected_training.short_description;
setDesc(u_selected_training_description);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2015 03:29 AM
Hello, almost there, I still cant manage to make it proper html, see below that I get all content in to input (this is what was suggested here) and it hold html tags as I took data from html field on referenced table.
What should I look for to make it nicely displayed on the entire page under text "Short Description" ?
It is how it look now
It is how it should look when user change data in reference field and proper html from description field from reference table is displayed