buttons beside a filed/control

hi does anyone know how to add a button beside a control. let’s say i have text box then i want to have a button with particular functionality on it. how to do so? thank u!. :slight_smile:

Hi rendonjerome14,
You can use jQuery.


$('#selector').append('<input type="button" value="label" onClick="call_function()">');

hi. thanks :slight_smile: just one more question, how will i disable an item list in a check box for example. my check box has item1, item2, item3. i wanna disable item3 thru code.

how to do that? where will I use this code?
$(’#selector’).append(’<input type=“button” value=“label” onClick=“call_function()”>’);

To disable an item using jquery:


$('#selector').attr('disabled', 'disabled');

I recommend you to read about javascript and jquery. To read about jquery selectors: http://www.w3schools.com/jquery/jquery_ref_selectors.asp

It’s not always a matter of the javascript, but the way to apply it into your code. I think that it would help if there’s a sample of it somewhere. I for this reason avoid using javascript although I’m pretty familiar with JQuery(UI). But SC generates a lot so you need to be pretty technical to extract the knowledge you need to apply your customisations.

[SIZE=6]Example to disable input. [/SIZE]
Lets say that your field name is “myfield”, then your selector is “id_sc_field_myfield”.

Place this code onLoad:


echo "
<script>
$(document).ready(function(){
 $('#id_sc_field_myfield').attr('disabled', 'disabled');
});
</script>";

Scriptcase is awesome, but if you want to make better customizations you need of javascript and php.