No announcement yet.

Hiding the dropdown on Select.

  • Filter
  • Time
  • Show
Clear All
new posts

  • Hiding the dropdown on Select.

    Hi everyone this is my latest problem and I hope someone can assist me

    All I want to achieve is have a field in a form with a button to link to another form that has various options to get the end result of a category id.

    so far so good its all working and passing the variable back to the form and the correct category is shown.

    now my problem is in scriptcase the 'edit button' / link will only work with a select dropdown. but in this instance I actually don't need the option to select I just want the edit button/link and to show the name only.

    so far I have done this and I am struggling to get any further. in the javascript form>onload i put this code.

    function sc_form_onload()

    var cat = $( "#id_sc_field_id_category_default" ).text(); $("#id_sc_field_id_category_default").css('display ','none'); $("#idAjaxSelect_id_category_default").text(cat) ;

    $("#id_sc_field_id_category_default").change(funct ion(){ $("#idAjaxSelect_id_category_default").text($( "#id_sc_field_id_category_default" ).text()); });

    all I get is the name showing from the initial loading and nothing changes.

    I really wish scriptcase would make it possible to add a button to a field. I love this software but sometimes you get stuck on such a simple thing.

    can anyone help ?

  • #2
    Create a field of type HTML image, and assign it the image of a button, move that field to next to the field you want it next to, and set the link in the image field. in the form to be opened check / do what you need in it's onLoad event
    Last edited by adz1111; 07-06-2015, 02:40 PM.


    • #3
      Ok thanks ADZ1111, I've done that and the link works, however I have selected the option to close after insert/update and this will not work, I have chosen the right option to link the fields and it does not pass the Variable. any ideas ?


      • #4
        create a [global variable] that the called form sets / updates, you can then read that wherever (after the called form is closed)


        • #5
          Global Variable is set, I have it set as out/post in the called form, and get/in in the main form I must be missing something


          • #6
            That's correct, the calling form it will be in. The app that initially sets the variable is out, all other apps are in, even if they subsequently update the variable.

            If you wish to initialise the variable in the calling form instead (even if its to just '') then it should be defined as out in that form, and the called form will then see it as in.
            Last edited by adz1111; 07-06-2015, 04:07 PM.


            • #7
              I have the global variable showing fine in the called form using print_r, but it is not passing to the calling form at all. i have tried the field i need the data in as a text with select, as a text only and as a select. I've also associated the field in the onload event script ini but nothing, stuck again.


              • #8
                what code do you have in the calling form that refs that variable?

                and / or what do you have in the lookup bit of the field on the calling form that is using that variable?


                • #9
                  this is in onload and in application ini {id_category_default}=[catdefault]; the select is SELECT id_category,name
                  FROM ps_category_lang
                  WHERE id_category=[catdefault]


                  • #10
                    Is [catdefault] / id_category a string?

                    If so it needs to be - note quotes:

                    SELECT id_category,name
                    FROM ps_category_lang 
                    WHERE id_category='[catdefault]'
                    EDIT: likewise, if {id_category_default} is a string:

                    Last edited by adz1111; 07-06-2015, 06:29 PM.


                    • #11
                      [catdefault] and id_category are not strings anyway I tried using '[catdefault]', still can't get it to pass the variable or at least show the variable when I insert a record in the called form then add.

                      I am wondering this now, for a test I have passed a value from the calling form to the called form and that works fine, so therefor I'm wondering if I need to do something else as the calling form is open maybe its not being triggered to show the new value, but this worked fine when I used a link from the field, or maybe its because the called form is in insert mode would this make a difference?


                      • #12
                        The global variable is not something that is passed. It exists in an area that all elements of your system can access. Now, the only possible reason it might not be readable is because there are session elements at play. One way of ensuring that is not an issue is to go to where the global var is defined as "out", and also make sure "session" is ticked. Make sure to re-gen.


                        • #13
                          Done that this morning :-(


                          • #14
                            This is now solved.


                            • #15
                              Originally posted by Mescart View Post
                              This is now solved.
                              What's you did?

                              Professional Scriptcase Services
                              Some Customers opinions