Discussions

 View Only
  • 1.  Button Named after data in a field

    Posted 06-23-2017 11:41
    I am using a text formula to generate a button and need to do something outside of my skill set. I need the button name to change based on the data in a specific text field. It sounds odd but is actually needed. Here is a sample of the formula.....

    // Begin button style
    var text bgcolor = "#A5E294";
    var text txtcolor = "black";
    var text style = "style=\"text-decoration: none;\n\n box-shadow: 3px 3px 1px #888888; \n\n background:" & $bgcolor & ";\n\n border-radius: 3px;\n\n padding: 5px 8px;\n\n color: " & $txtcolor & ";\n\n display: inline-block;\n\n font: bold 700 24px/1 \"Calibri\", sans-serif;\n\n text-align: center;\n\n text-shadow:none;";
    // End button style

    If([Can work be invoiced?]=false,
    "<a " & $style & " href=" &
    URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&rid=" & URLEncode ([Record ID#])
    & "&_fid_104=1"
    & "&_fid_105=1"
    & "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=q&qid=128")
    & ">Add to Billing</a>"
    ,"")


  • 2.  RE: Button Named after data in a field

    Posted 06-23-2017 12:29
    Inorder to change the label name you can use API_SetFieldProperties

    https://target_domain/db/target_dbid?a=API_SetFieldProperties&fid=6&label=labelchanged&apptoken=app_token
    Examples:

    target_domain : sampledev.quickbase.com
    target_dbid: Table ID [bjhsda32s]
    6: Your field id
    labelChanged : get the value of the field
    app_token: if you made the app token required 


  • 3.  RE: Button Named after data in a field

    Posted 06-23-2017 12:46
    I guess I wasn't clear, I don't want to change the name of the field just the labeling on the button itself.


  • 4.  RE: Button Named after data in a field

    Posted 06-23-2017 12:59
    Jason , so you need to change the label of the formula field itself, no problem instead of  6 give the fid of the formula field on the below formula


  • 5.  RE: Button Named after data in a field

    Posted 06-23-2017 13:07
    At the bottom the formula has Add to Billing _that is the custom  name added to the button for the user. I want to take a field [Record Name] that would contain a the related name of a field in another table. The data would be June 2016 _so I would be able to have button say _Add to June 2016 Billing_. This would make the label on the button not the field dynamic so that the end users would clearly see what record is the data is applying to.


  • 6.  RE: Button Named after data in a field

    Posted 06-23-2017 13:57
    i think then you can use iol technique and load a script  then you can call the [Record Name] field id value and assign it to the label  name 

    sample Code

    $("#tdf_2 a").text($("#_fid_11").val());

    tdf_2 
    _is the parent div id for the formula field 
    _fid_11: [Record Name] 



  • 7.  RE: Button Named after data in a field

    Posted 06-23-2017 12:54
    var text value = [LabelName];

    If(ToNumber([CheckBox])=1,
    URLRoot() & "db/" & Dbid() & "?a=API_SetFieldProperties&rid=" & URLEncode ([Record ID#])
    & "&fid=6"& "&label="& $value &" "& "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=q&qid=1")
    & ">Add to Billing</a>" 
    ,"")

    LabelName: field which you are entering the new value which should be reflected as label name
    6: 
    instead of this give your fid of the target field which you want to change

    I Hope this will solve your issue

    Tested Working for me!!


  • 8.  RE: Button Named after data in a field

    Posted 06-23-2017 13:49
    Your information will help with some future work. The final solution I got for the naming was this:
    & "> Add to "&[IRF - Record Name]&"</a>"
    I kept making formatting mistakes. Thanks for the help and  hopefully one day I can return the help.