14 Replies Latest reply on Sep 19, 2013 3:02 PM by raybaudi

    GetAsCSS ( text ) : odd behavior

    raybaudi

      This seems correct:

      GetAsCSS 1.png

      but this ?

      GetAsCSS 2.png

      The function's result isn't consistent

        • 1. Re: GetAsCSS ( text ) : odd behavior
          LyndsayHowarth

          That is perfectly consistent...

           

          You have bolded the text in the first sample, hence it created 3 spans... one for each style change.

          In the second example there is only one style.

           

          - Lyndsay

          • 2. Re: GetAsCSS ( text ) : odd behavior
            BruceRobertson

            I thought of saying that too. Then I looked at the alignment; which is recognized in the first example but not in the second.

            • 3. Re: GetAsCSS ( text ) : odd behavior
              raybaudi

              Yes, without any variation of the formatting, the alignment of the subsequent rows is not recognised

              • 4. Re: GetAsCSS ( text ) : odd behavior
                PalmDBS

                I've found the getascss to be fairly useless and problematic.  It woun't return ANY styling if you're text happens to matches the default (even if interspersed with differing styles, and even if you hard-define the desired format), which is useless when using that code in a different scope (outside of FM).  I got so frustrated the one time I tried using it I haven't touched it since.

                • 5. Re: GetAsCSS ( text ) : odd behavior
                  steve_ssh

                  PalmDBS has made an important point:

                   

                       GetAsCSS is only returning formatting which would be considered an exception to the field's defined formatting.

                   

                   

                  In your example, Daniele:

                   

                  Is your field formatted with text-align: right ?

                   

                  If so, then, even if it does not have what we would consider the most helpful output, GetAsCSS could still at least be regarded as having predictable output.

                   

                   

                  I recently used GetAsCSS in order to to be able to convey both data and formatting to a system external to FM.  This endeavor became much easier once I added a scrubbing function on the external side which cleans up and pre-processes the data received from GetAsCSS.   I hadn't actually run across the issue concerning default formatting not being included; my main motivation was to clean up some of the output whereby text formatted with both underline and strikethrough resulted in CSS which I believe is mal-formed.  At the very least, it resulted in CSS that would not be recognized by all browsers.

                   

                  Best regards,

                   

                  -steve

                   

                  Message was edited by: steve_ssh:  Removed a portion of the post which was incorrect.

                  • 6. Re: GetAsCSS ( text ) : odd behavior
                    BruceRobertson

                    It really doesn't matter if the field is set up text-align right. The example has MIXED alignment. GetAsCSS just doesn't see it.

                    • 7. Re: GetAsCSS ( text ) : odd behavior
                      raybaudi

                      steve_ssh ha scritto:

                       

                      PalmDBS has made an important point:

                       

                           GetAsCSS is only returning formatting which would be considered an exception to the field's defined formatting.

                       

                       

                      In your example, Daniele:

                       

                      Is your field formatted with text-align: right ?

                      I'm aware of what steve said and the field is formatted with text_align left ( in Layout Mode ).

                       

                      BTW: I'm attaching a simple .fp7 file with a custom function that corrects the GetAsCSS ( ) errors.

                      • 8. Re: GetAsCSS ( text ) : odd behavior
                        steve_ssh

                        I've taken a closer look and I see that you are correct.  I'll update my post.

                         

                        Thanks Bruce,

                         

                        -steve

                        • 9. Re: GetAsCSS ( text ) : odd behavior
                          raybaudi

                          "woun't return ANY styling if you're text happens to matches the default"

                           

                          But you, the developer, know which are the default styles for that field and could adjust the relative calculation.

                          • 10. Re: GetAsCSS ( text ) : odd behavior
                            raybaudi

                            BruceRobertson ha scritto:

                             

                            GetAsCSS just doesn't see it.

                            Yes, that is the odd behavior ( bug ) of that function.

                            • 11. Re: GetAsCSS ( text ) : odd behavior
                              LyndsayHowarth

                              Well spotted Bruce! It was too obvious... I should have looked closer....

                              I had spent all day chasing a stray semicolon...

                               

                              LOL

                              - Lyndsay

                              • 12. Re: GetAsCSS ( text ) : odd behavior
                                PalmDBS

                                Well wait a second Daniele, how is it an "odd behavior (bug)" in response to this post, but in response to my post it's the developer's responsibility to "adjust the relative calculation?"  Since this is known, shouldn't it also be the developer's responsibility to change some style to trigger it to see the alignment change?  I don't think so.

                                 

                                Aside from the alignment issue, bottom line is that it should return a full set of styling, not just styling that differs from the default.  In order to offset this, I have to manually add a wrapper around the GetAsCSS output with CSS styling that matches the default for the field.  But what happens when another person goes on the layout and changes the default styling for that field?  Should I then have to then go and re-adjust all my scripting to change the wrapper to match?  It's absurd. 

                                 

                                IMHO, the field's styling should have absolutely no bearing on the GetAsCSS output (other than being INCLUDED, not excluded, from the style).  There's not that much in the formatting bar, so to expect GetAsCSS to return values for the font, size, color, background, bold, italic, underline, and alignment properties for all content in the field is not too much to ask.

                                 

                                Mike Reilly, Owner

                                Palm Database Solutions

                                www.PalmDBS.com

                                Solutions@PalmDBS.com

                                858.215.2555 Phone

                                858.345.3922 Fax

                                FileMaker 12/11 Certified Developer

                                • 13. Re: GetAsCSS ( text ) : odd behavior
                                  raybaudi

                                  PalmDBS ha scritto:

                                   

                                  in response to my post it's the developer's responsibility to "adjust the relative calculation?"

                                  No, it is not a developer's responsability, but he could adjust the calculation.

                                   

                                  PalmDBS ha scritto:

                                   

                                  But what happens when another person goes on the layout and changes the default styling for that field?

                                  Isn't he another developer? I do not think that you leave to the user the ability to access the Layout Mode.

                                  • 14. Re: GetAsCSS ( text ) : odd behavior
                                    raybaudi

                                    Daniele Raybaudi ha scritto:

                                     

                                    No, it is not a developer's responsability, but he could adjust the calculation.

                                    An improvement of the result ...