Inline button in Multiple Record Form

Dear Forum Members,

Is there any way to place buttons inline(I tried with label fields and input type button) in multiple record form which can do php method or JavaScript method?

In multiple record form how do I setfocus to a specific field by javar?


to answer your first question, create a label field and onLoadRecord:
{label_field} = “<button type=‘button’ onclick=alert(‘Test’)>Click here</button>”;

To your second question:
Let’s assume you have a field {custname}. To set the focus to a specific name you also need to know (calculate) the row number where it’s shown (ie 3).
Scriptcase has an (undocumented) ajax/javascript function scFocusField() which can be used to set the focus.
All you have to do is to piece together the field name and row number and call this function by using the sc_ajax_javascript() macro.


Hope this helps.


1 Like


Thanks for your quick response. First one, my requirement is e.g., i want the button which provided by sc inline not label with input type=button… or if that, how do I do the php operation with db interaction with that not just showing alert. I know you can help me in this regard as far in this forum you’re the genius!
Second, you’ve given the example for specific record but how do I determine dynamically in which record I’m in?

Thanks & Regards

[QUOTE=rajibul;27341]Hi JSB,

or if that, how do I do the php operation with db interaction with that not just showing alert.

Alert() is just an example, you can call your own javascript methods instead.

You can’t call php methods, however depending on your needs a solution could be to call a blank application where you can do all your php stuff and redirect back to your form.


{label_field} = “<button type=‘button’ onclick=“location.href=’…/my_blank_app/my_blank_app.php’” >Click here</button>”;

To get the row number you’re in is a bit tricky since there is no access to those values, so we need to calculate it with the help of an array.

[rows] = array();
[cur_row] = 1;
// set both variables to Out

[rows][] = {cust_id}; //store the id in the array

[rows][] = 0; //mark the end of the page shown

[rows] = array_slice([rows],array_search(0,[rows])+1); //reset the array for the new page

You need an Ajax Event (i.e. onClick) on any field (i.e. {custname})
[cur_row] = array_search({cust_id},[rows])+1; // that’s the row number you’re in

Somewhere in your app:
$focusfield = {custname}.’_’.[cur_row];

There you have it. :slight_smile:


How to easily call other grid/form and transfer one variable as reference?

Click here => transfer {this_value_to_form} and open Form_Worker

I tried many thing, including:

{Test} = “<button type=‘button’ onclick=“sc_redir(Admin_menu, ‘parm1 = {idCustomer}’, ‘_parent’)”>Click here</button>”;

And also:

function REDIRTEST()
sc_redir(Admin_menu, “”, “_parent”);

{Test} = “<button type=‘button’ onclick=‘REDIRTEST()’>Click here</button>”;

Thank you for your help!