can we add a new button to a block

hi

I’m still new and exploring scriptcase, looks nice so far.

Wondering if I want to add some buttons next to the fields in the blocks? like if you want to make a new button and add it to the right of the field as “apply” or “validate” - I noticed the validation image, my need is a new button that from the toolbar but to be shown along with the fields? does it make sense? similar to the ones come with field type URL and Email, just additional button to the right of the field…

in Form application (single record)

[QUOTE=Leon;32863]hi

I’m still new and exploring scriptcase, looks nice so far.

Wondering if I want to add some buttons next to the fields in the blocks? like if you want to make a new button and add it to the right of the field as “apply” or “validate” - I noticed the validation image, my need is a new button that from the toolbar but to be shown along with the fields? does it make sense? similar to the ones come with field type URL and Email, just additional button to the right of the field…

in Form application (single record)[/QUOTE]

In general there are only six places where the buttons can be put if you use the add button functionality, top, bottom and left, middle and right.

What I sometimes do is that i create a custom field and make that of type image. Then I have a small image of a button which can be put behind some field, although the screenpainting capabilities are (very) limited. You need to create a group with two fields (the field and your button) to allign them next to each other. Disadvantage is also that you can only put a link behind that image and you cannot use the button events. Sometimes I link to a blank application to do some things and then sc_redir back to the original application. Sometimes you have to go with what’s available :wink:

hope this helps.

Hi
-1- Create your button and javascript you want to be performed when the button is clicked.
-2- Place the button in the toolbar and run the application
-3- Right click your button and click ‘Inspect element’ you will see a code like that (that’s an example, your code will be a little different):

<a href=“javascript: sc_btn_sc_btn_1()” id=“sc_sc_btn_0_top” onclick=“sc_btn_sc_btn_1(); return false;” class=“scButton_default” style=“vertical-align: middle; display:inline-block;” onmouseover=“if(this.disabled){ return false; }else{ main_style = this.className; this.className = ‘scButton_onmouseover’; }” onmouseout=“if(this.disabled){ return false; }else{ this.className = main_style; }” onmousedown=“if(this.disabled){ return false; }else{ this.className = ‘scButton_onmousedown’; }” onmouseup=“if(this.disabled){ return false; }else{ this.className = ‘scButton_onmouseover’; }”>Cliquez pour d?but visite</a>;

Copy that code

-4- Create your field and put it where you want in your form
-5- In the onLoad event, create a code like :

{myLabel}=’<a href=“javascript: sc_btn_sc_btn_1()” id=“sc_sc_btn_0_top” onclick=“sc_btn_sc_btn_1(); return false;” class=“scButton_default” style=“vertical-align: middle; display:inline-block;” onmouseover=“if(this.disabled){ return false; }else{ main_style = this.className; this.className = ‘scButton_onmouseover’; }” onmouseout=“if(this.disabled){ return false; }else{ this.className = main_style; }” onmousedown=“if(this.disabled){ return false; }else{ this.className = ‘scButton_onmousedown’; }” onmouseup=“if(this.disabled){ return false; }else{ this.className = ‘scButton_onmouseover’; }”>Cliquez pour d?but visite</a>’; (The code you have copyed)

sc_label(“nameOfYourField”)={myLabel};

-6- Remove the button in the toolbar and run your application :slight_smile:

1 Like

Nice! Like that Q&D approach.

Good Idea!. I will try

Great :smiley: thanks danigo.

one small question to Mr Drent after thanking you for your previous feedback. did you mean by group buttons something like create 2 custom files and hide them then combine them in other filed like {field_new_db_field}={field_1_custom} {field_2_custom} ??

in this case, can’t we apply some ajax events to custom field (html image) so it will be applied on click!?

No, I create a custom field of type image and put that in the form. But to be able to customize layout I need to create a block and apply the two fields (the original + the image). But the disadvantage is that you have to create a link, in that matter the other solution might work better.

We need a field type “button”

Dave

That sounds like a familiar request I also made… :slight_smile:

yes I understand now, also sdanigo solution is great, will give it a try. thanks again Mr Drent and sdanigo

Dave is speaking correct, a field like button will be great to have.

rr, here we have more than workaround to do this request, will try and see which one suites better :slight_smile:

thanks