Discussions

 View Only
  • 1.  Using a field to redirect records to a custom form?

    Posted 09-26-2014 20:54

    Is there a way, possibly using image onload, to cause a record to be viewed/edited in a custom form based on the condition of a field in the record?

    Use case:

    I want the records in my projects table to represent either projects or project requests depending on the selected content ("Initiating") in a multiple choice field called 'Phase'. I could implement both views of the data (project and request) with form rules, but the project form already has a ton of rules related to various workflows. It would be much cleaner to implement the request view in it's own form - which I have done.

    Requests are created using a custom "Create Project Request" button on the Homepage or via the Project Requests report. There are circumstances, though, where these records will open using the default "Projects" form. I want to stop that from happening. records should always use the request form until their Phase is set to something other than "Initiating".



  • 2.  RE: Using a field to redirect records to a custom form?

    Posted 09-30-2014 14:45
    >Is there a way, possibly using image onload, to

    The image onload technique can solve all QuickBase problems.

    Code similar to this should do the job:

    Pastie Database
    https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=344


    Arrange for the image onload field to be the only field on the initial view/edit page. When that page loads it will redirect to the custom form (dfid=11 or dfid=12) based on the value of [Phase] (fid=6 in my sample code).

    There might be a typo in the code as I have not tested it but you will have to make your own changes to integrate this into your application correctly.

    Also it is worth mention that if [Phase] is included on the edit version of the form you could create a confusing situation where if [Phase] is changed the user would be editing the record with possibly the wrong form. It probably isn't an issue for you use case but when you customize QuickBase forms or workflow you have to watch out for situations where the form's state is inconsistent with what QuickBase or the users thinks the forms state is. For example, you could change the value of a field through an AJAX call the form may still be displaying the previous value.


  • 3.  RE: Using a field to redirect records to a custom form?

    Posted 10-30-2014 21:03
    My implementation of this doesn't appear to be populating the phase variable. The only changes I made were to...
    * add my dbid
    * change the clist field number to match my app
    * change the fids to match my app

    Any ideas?


  • 4.  RE: Using a field to redirect records to a custom form?

    Posted 05-10-2015 14:29
    I am also trying to implement this.  Have you been able to find what the problem was?


  • 5.  RE: Using a field to redirect records to a custom form?

    Posted 05-10-2015 17:25
    >I am also trying to implement this. ...

    This question is 8 months old! It is best to ask a new question so I get a chance to earn more forum points. I will make an exception in this case.

    I created a simple application with four fields:

    [Phase]
    [Name]
    [Number]
    [-]

    The default form has one field [Phase] from which you can select one of two options "Phase 1" or "Phase 2". If you next edit or view a record with [Phase]="Phase 1" you will be redirected to the form with dfid=10 which will allow you to edit or view just the [Name] field. Likewise, if you next edit or view a record with [Phase]="Phase 2" you will be redirected to the form with dfid=11 which will allow you to edit or view just the [Number] field.

    In a real application your forms will be more complex but you can adopt the same basic logic. Actually I play the Jeopardy music before redirecting to the appropriate edit or view form for dramatic effect. If your uses don't like the Jeopardy music you can change it to some other game show music (see http://www.soundboard.com/sb/Game_Show_Theme_Songs) or non-game show music that may be more relevant to your industry - the code is very versatile.

    Form Switcher - List All
    https://haversineconsulting.quickbase.com/db/bjw9judnj?a=q&qid=1

    Pastie Database
    https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=379


  • 6.  RE: Using a field to redirect records to a custom form?

    Posted 05-10-2015 20:51
    Sorry for been new in the QB forum...  I was able to finality make it work, THANKS.

    Prior to making my comment and using several of your pasties I was able to implement:
    - the IOT and working with the generic code.
    - the default form with the [-] field showing dfid=12, and 3 other forms to view/edit my records with (dfid=2,10,11)

    No knowing much yet about QB API or jQuey, I  was struggling to modify your code to point to my "Selector" field.
    The field is [Form] with fid=234 (values of "V1", "V2" or "V3").

    I plugged my field ID here:
        clist: "6"  -----> replace by "233"

    The other tricky bit was this area of the code:
        var phase = $("phase", xml).text();
        if (phase == "Phase 1") {

    I initially had (which did not work)
        var form= $("Form", xml).text();
        if (form== "V1") {

    My code with NO CAPS works:
        var form= $("form", xml).text();
        if (form== "V1") {

    If you try a field with a name that is 2 or more words it does not work...
    Any reasons why????

    Once again, thanks!!!!!!


  • 7.  RE: Using a field to redirect records to a custom form?

    Posted 05-10-2015 21:04
    >My code with NO CAPS works:
    >If you try a field with a name that is 2 or more words it does not work...

    In the XML response to an API call QuickBase lowercases and substitutes special characters in field names with the underscore character. So if you field name was [Monkey Business!] QuickBase would synthesize the tag <monkey_business_>. You would then use the following in code:

    $("monkey_business_", xml) ...


  • 8.  RE: Using a field to redirect records to a custom form?

    Posted 05-31-2019 18:28
    Anyone here available to help me with this technique at the conference by chance? :)


  • 9.  RE: Using a field to redirect records to a custom form?

    Posted 05-31-2019 18:52
    I've been using Dan's IOL/BOL techniques pretty much every day at work. It's really opened up our environment.

    I'll be at the conference as well. Hope to see you there! :)