- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2016 12:58 AM
Hi,
I have created a UI macro, having an input field, which I am using in a variable in record producer.
After submitting the item, and checking record created. The variable editor have empty values in those input fields.
How should I bring the data entered in UI macro variable to the variable editor. I want to show exact same field data with the same style in record table.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2016 06:29 PM
What I am saying is that your input field "<input type="text" name="newsal" />" is in the context of the macro, and not the Record Producer, so the producer script I don't believe can read that value and do anything with it. You would actually need to have an onchange script in your macro write the value to a variable in your producer (the variable can be hidden) so that it is available to the producer script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2016 05:15 PM
I would have to see your code, but my recollection of UI Macros in variables is that they are in a container which is a different context from the record producer... which means you need to manually save and load values into those input fields in your UI Macro code. For instance, you have a UI Macro with a <g:ui_input_field> tag. You have given this field a name, but unless you take the value from this field and write to a field in your producer script, it is just an HTML input field. Naming it the same as a field on your form doesn't work, because the producer knows about the UI Macro variable, but not about its content.
-Ken
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2016 11:42 PM
Actually my requirement is to have two input field and a button, after clicking on button the data is taken from 1st input field and after calculation write the value in other field.
I have created the macro for the same, because creating different text variables and UI macro button was giving the issue of how to take and set the values.
code have two input fields current sal, and arrears. User, inputs current sal. There is another variable called rate in record producer, which have onChange client script and call rateValue(rate) function to set value of jvar_rate in script.
then the button calls setSalary(currentSal) function to calculate and set value of arrears.
This is working fine in macro but the values are not coming in record producer.
Code is:
<?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>
var rate = '';
function rateValue(rate)
{
jvar_rate = rate;
}
function setSalary(currentSal){
var sal=currentSal.value;
//alert(sal);
//alert(jvar_rate);
var newSal = (sal*jvar_rate)/100
//alert (newSal);
g_form.setValue("arrear", newSal);
}
</script>
<j:set var="jvar_rate"/>
<form>
Current Salary: <input type="text" name="currentsal" style="margin-left: 25%;" required="required"/><br/>
<input type="button" value="Calculate New Gross Salary" onClick="setSalary(currentsal)" style="margin-left: 35%;"/>
Arrears: <input type="text" name="arrear" />
</form>
</j:jelly>
As per my understanding, you are saying to save these in a different field in record producer, So if I create a new field, say multi text field, can I copy all these values in that field from UI macro.
Multi text field could be like
Current Sal:
Arrears:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2016 11:43 PM
Its not showing the code in above reply. Please find the code here
<?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>
var rate = '';
function rateValue(rate)
{
jvar_rate = rate;
}
function setSalary(currentSal){
var sal=currentSal.value;
//alert(sal);
//alert(jvar_rate);
var newSal = (sal*jvar_rate)/100
//alert (newSal);
g_form.setValue("newsal", newSal);
}
</script>
<j:set var="jvar_rate"/>
<form>
Current Salary: <input type="text" name="currentsal" style="margin-left: 25%;" required="required"/><br/>
<input type="button" value="Calculate New Gross Salary" onClick="setSalary(currentsal)" style="margin-left: 35%;"/>
Arrears: <input type="text" name="newsal" />
</form>
</j:jelly>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2016 06:29 PM
What I am saying is that your input field "<input type="text" name="newsal" />" is in the context of the macro, and not the Record Producer, so the producer script I don't believe can read that value and do anything with it. You would actually need to have an onchange script in your macro write the value to a variable in your producer (the variable can be hidden) so that it is available to the producer script.