I am new to servoy. My situation is, I am getting values from table to a dataset. In the dataset I am placing one html control which should trigger a method in another form. But the buttons placed and displayed in dataset don’t work.
Requesting for advice
About your question.
Most common issue with non working links are that the display (HTML) field is not set to not-editable.
And if you are trying to trigger Servoy methods make sure you use the following syntax:
// when referencing a local method - from the scope of the HTML field (!)
<a href="javascript:methodName()">some labeltext</a>
// referencing a method on another form
<a href="javascript:forms.formName.methodName()">some labeltext</a>
// referencing a global method
<a href="javascript:globals.methodName()">some labeltext</a>
You use … for this specific value but when you display the dataset you also wrap it in one. So it seems you should only use the ‘+dataset1.getMaxRowIndex()+’'.
NumTapes method is defined and implemented in globals.js.
I tried to implement the same method (using <a href…) for buttin onClick event and it didn’t work. The button is pressed and nothing happens. Code below
dataSet.setValue(i,5,‘
’+dataSet1.getMaxRowIndex()+‘
’)
One more query:
Can I place a simple button (not a bean)on the form and write some functionalities like VB?
NumTapes method is defined and implemented in globals.js.
Javascript is caps sensitive. Is your global method indeed named ‘NumTapes’?
soumyamahakul:
I tried to implement the same method (using <a href…) for buttin onClick event and it didn’t work. The button is pressed and nothing happens. Code below
dataSet.setValue(i,5,‘
’+dataSet1.getMaxRowIndex()+‘
’)
onClick requires Javascript and the Sun HTML renderer does not support that.
You can’t put variable arguments in the function name (only in custom functions inside methods). So you need to read the argument array in your code like so:
function showname()
{
var x = arguments[0];
globals.itemid=x
application.showForm(forms.LineDetail)
}
soumyamahakul:
It’s a learning. Don’t you think it’s strange declaring custom functions like this?
Methods can’t be defined with arguments in the function but any functions declared inside that method can have arguments in the function. I know it’s a bit odd, I guess this is a left over of how Servoy worked before 4.0.
The arguments[0] in the method should be a universal data type which can hold any data type as we are not declaring any datatype. Like variant?
The variable arguments is an Array and in Javascript an array can hold any datatype.