Discussions

Expand all | Collapse all

Identify current url, OR, view / add / edit of a form.

  • 1.  Identify current url, OR, view / add / edit of a form.

    Posted 12-05-2014 12:35
    This is probably really easy - but I am stumped.

    I would like to display a piece of bright colorful text on my form and have it be conditional depending on whether the user is adding a record, viewing a record, or editing a record.

    Identifying that the user is adding a record is not an issue, a record id does not exist until after created.

    I can not figure out how to tell my formula text field that the user is either in view or edit while on the form. If I could get the exact url from the browser of the user, I could use the "dr" or "er" as my indicator for my formula.

    If anyone could share any ideas - I think I might be stuck within a box and need some other brains to have a thunk at it.

    Thank you!


  • 2.  RE: Identify current url, OR, view / add / edit of a form.

    Posted 12-05-2014 12:58
    Use three fields.  Then set Form properties to show them respectively for View, Edit, Add.


  • 3.  RE: Identify current url, OR, view / add / edit of a form.

    Posted 12-05-2014 20:44
    VERY SIMPLE!!! Thank you!!! HAHAHAHA!!!


  • 4.  RE: Identify current url, OR, view / add / edit of a form.

    Posted 12-05-2014 20:48
    :)


  • 5.  RE: Identify current url, OR, view / add / edit of a form.

    Posted 12-05-2014 20:49
    Didnt mean to convert my comment to an answer... wasnt sure if I had marked your comment as answering my question... kinda confusing. thanks again!


  • 6.  RE: Identify current url, OR, view / add / edit of a form.

    Posted 12-05-2014 20:51
    It shows as 2 answers, but I think that you (but not me) has the ability to mark mine as the "Recommended answer".


  • 7.  RE: Identify current url, OR, view / add / edit of a form.

    Posted 03-05-2018 10:16
    HI Guys, I am looking at the exact same problem, please can you share the code for the button and fields?


  • 8.  RE: Identify current url, OR, view / add / edit of a form.

    Posted 03-05-2018 10:18
    Can you then also do an "if statement" in the URL field, to say "IF field=add, then use specific URL, of field=view, then use specific URL, otherwise use Edit URL"?


  • 9.  RE: Identify current url, OR, view / add / edit of a form.

    Posted 03-05-2018 12:47
    No, you cannot do an IF based on the URL. The IF formula cannot "see" into the URL.


  • 10.  RE: Identify current url, OR, view / add / edit of a form.

    Posted 03-05-2018 13:03
    It can be easily accomplished with script using the IOL technique. In fact the generic module.js template used with the IOL technique decodes precisely what page you are on to decide what modifications are appropriate for each type of page.

    I would ask a new question asking for the precise behavior you want as the original question is three years old.

    Here is the generic IOL module.js template:
    (function(){
      var querystring=document.location.search;
      if (/dlta=mog/i.test(querystring)) {
        //GRID EDIT PAGE ========================================
        alert("You are on the Grid Edit Page");
      } else if(/a=er/i.test(querystring)) {
        //EDIT RECORD PAGE ========================================
        alert("You are on the Edit Record Page");
      } else if (/a=API_GenAddRecordForm/i.test(querystring)) {
        //API_GenAddRecordForm PAGE ========================================
        alert("You are on the GenAddRecordForm Page!");
      } else if (/a=GenNewRecord/i.test(querystring)) {
        //ADD RECORD PAGE ========================================
        alert("You are on the Add Record Page");
      } else if (/a=nwr/i.test(querystring)) {
        //ADD RECORD PAGE ========================================
        alert("You are on the Add Record Page");
      } else if(/a=dr/i.test(querystring)) {
        //DISPLAY RECORD PAGE
        alert("You are on the Display Record Page");
        $("img[qbu=module]").closest("td").css("background-color","#FFFFFF");
      } else if(/a=q/i.test(querystring)) {
        //REPORT PAGE ========================================
        alert("You are on the Report Listing Page");
      } else if(/a=td/i.test(querystring)) {
        //TABLE DASHBOARD PAGE ========================================
        alert("You are on the Table Dashboard Page");
      } else if (/a=FinishEditRecord/i.test(querystring)) {
        //FINISH EDIT RECORD PAGE ========================================
        alert("You are on the Finish Edit Record Page");
      } else if (/a=API_GenAddRecordForm/i.test(querystring)) {
        //API_GenAddRecordForm ========================================
        alert("You are on the API_GenAddRecordForm Page"); 
      } else {
        //OTHER PAGE ========================================
        alert("You are on the Some Other Page");
      }
    })();