Button in grid form to open form

Hi, I created new field in form Editable grid view, clickme.

Then on onLoadRecord i insert:
{clickme} = “<button type=‘button’ onclick=“location.href=’…/form_bas_indirizzi/form_bas_indirizzi.php’” >Click here</button>”;

All works fine,the app form_bas_indirizzi is open.

Now, i want to open form_bas_indirizzi in modal.
I insert:
{clickme} = “<button type=‘button’ onclick=”.sc_redir(form_bas_indirizzi.php, ‘’, ‘modal’).">Click here</button>";

But doesn’t work.
Error:Parse error: syntax error, unexpected ‘if’ (T_IF) in /opt/NetMake/v8/wwwroot/scriptcase/app/informaCRM/form_view_ind_indirizzi/form_view_ind_indirizzi_apl.php on line 3024

How can i do it ?
Thanks
Marco

you are misusing the sc_redir macro

for what you are trying you should use the sc_make_link macro to do somehting like this


$link = sc_make_link(form_bas_indirizzi);
{clickme} = '<button type="button" onclick="' . $link .  '">Click here</button>';

Hope this helps.

Kind Regards

It does not work. Clicking nothing happens

Share your code with me. so i can take a look

Regards

Please make it public - I have the same problem…

I posted it here: http://www.scriptcase.net/forum/showthread.php?7025-Inline-button-in-Multiple-Record-Form

My post Copy/Pase:

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

Like:
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!

how do I share my code with you? My code is in onLoadRecord:

{clickme} = “<button type=‘button’ onclick=”.sc_redir(form_bas_indirizzi.php, ‘’, ‘modal’).">Click here</button>";

The problem is that sc_redir(form_bas_indirizzi.php, ‘’, ‘modal’) not work. the app is not opened in modal mode.

I think it’s a bug

sc_macros are for use in the application events. You can’t call php functions from javascript it’s just not possible and has nothing to do with SC.

You might have more luck with this procedure.

Go to the Link section of the grid and click on New Link. Choose field, select your {clickme} field and follow the instructions.
At the end selct Modal for the ‘Link Operation Mode’.

Head over to the onRecord event

{clickme} = “<button type=‘button’>Click here</button>”;

That’s it.

jsb

OK - thank you for this last post.

Next question around the same problem… Can we call SC Application with php somehow?
I need to pass one or two variables to called app and it would be nice if I can use button in

Yes, but you need to put a little bit more fish by the butter.

jsb

a little bit more fish by the butter
…i have the same question :wink:

I want to duplicate a data record into a another table (with a sql command). My first idea - the button start a blank_application with own your php code and then you can load the next application with sc_macros. Its a long way - perhaps there are a lot of another alternatives.

[QUOTE=jsbinca;32426]Yes, but you need to put a little bit more fish by the butter.

jsb[/QUOTE]

May I ask for instant solution? How to do it?

[QUOTE=scripti0815;32486]…i have the same question :wink:

I want to duplicate a data record into a another table (with a sql command). My first idea - the button start a blank_application with own your php code and then you can load the next application with sc_macros. Its a long way - perhaps there are a lot of another alternatives.[/QUOTE]

Do you want to copy/paste data from one table to other table? It is not subject for this thread. Please write me pm and I will answer it. It is quite easy task.

Or do you want to make button “in line” to do this?

Hello mitja,

the click on the button should start some own php code (for example a sql command and forwarding another application) . If this is not your question then i have to start a new post. Sorry:)

Thanks!