Announcement

Collapse
No announcement yet.

Start form app in insert mode from Main Menu

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Start form app in insert mode from Main Menu

    Hi All,
    I have a form application with with Single record option. How can I create a link to this application from my main menu to open it in insert mode? My idea is to have a menu item called 'Add new record' and when user click that option it will open the form in insert mode.

    I cannot use sc_apl_conf("my_form_name","start","new") in appinit event as I need this form in somewhere else to open in edit mode.

    Regards,
    Aari

  • #2
    Why don't you use scriptinit and use a condition to do the conf?
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      Hi aducom,
      Thank you for your quick reply. Could you please explain little bit further about using the condition?

      Appreciate your assistance.
      Regards,
      Aari

      Comment


      • #4
        try in toolsbar disable options UPDATE and DELETE

        Comment


        • #5
          so what condition i should use?

          In main menu it calls "my_form_name" and it will open the form. then in appinit what do i have to look for in order block update and delete? i know how to block those options but just can't get my head around the condition.

          Am i missing out something very simple here?

          Comment


          • #6
            no code. OPEN FORM - CONFIGURATION - TOOLSBAR disable options UPDATE and DELETE.

            Comment


            • #7
              This will only allow insert of code. If that's your need then it will work. Otherwise, if you want one application to behave differently depending on the application which is calling it then you can set a global var like:

              [glob_insert]=1; to start in insert mode and
              [glob_insert]=0; to start in edit mode.

              Then you do a sc_redir(your.php);

              in this 'your'.php you do onscriptinit:

              if ([glob_insert]==1){
              sc_apl_conf("my_form_name","start","new")
              }

              But the option of alvagar works too. You can enable/disable these buttons in the same event by using a macro.
              Albert Drent
              aducom software netherlands
              scriptcase partner, reseller, support and (turn-key) development
              www.scriptcase.eu / www.scriptcase.nl

              Comment


              • #8
                @alvagar - thank for your suggestion but that will permanently block edit function of this form. I only need to start in insert mode if user click 'Add new Record' in main menu. Otherwise it will go to browse mode which then users can add/edit data.

                aducom - your solution works perfectly if I can set that global variable from main menu. Inside an app I can do this by setting the global variable to "1" and then calling my form. But how can I do that when I call this form from a Menu?

                Please see attached image.

                main_menu.jpg

                Comment


                • #9
                  ohh noo I cannot believe I missed this one. Looking at macros for Main Menu, I found that there is a macro already for this.

                  All you need to do is add this code onExecute event inside main menu application.

                  // item_12 is the menu item to call 'Add new record'

                  if ({sc_menu_item} == "item_12")
                  {
                  sc_apl_conf("form_Employees", "start", "new");
                  }

                  Thanks guys for your input on this.

                  Comment

                  Working...
                  X