Aller au contenu principal

remove commas in Display Form

Commentaires

6 commentaires

  • Mike Diss-Torrance

    My coworker Umamaheswara Reddy Velupucharla came up with a solution for something he was working on.  I believe he applied the formatting to the text box as the form loads. 

     

    When displaying numeric information in the VertiGIS Web App, text boxes automatically format values with commas as thousand separators. This enhances readability for users. However, when editing is completed, and the "Save Changes" button is clicked, these commas must be removed before saving the data in the backend.
    To achieve this in the VertiGIS workflow, you can use JavaScript's replace function with a regular expression to remove all commas from the input value.
    
    
    JavaScript
    $ParkingLotForm.state.txtConstructionCost.value.replace(/,/g, '')
    
    
    /,/: Matches all commas in the string.
    g: Stands for "global," ensuring that all commas in the string are replaced, not just the first one.
    '': Replaces each comma with an empty string (effectively removing them).
    1
  • Gareth Evans

    I believe this may be related to the way Number form elements behave as text boxes. 

    The solution Mike mentioned is one way to do it. Another may be to use a Parse Number activity to handle the form element output and use later on in your math function.

    I found a basic example of a workflow that shows all math activity expressions here, made by our QA team. 

    1
  • Nico Burgerhart

    Johanne van Linge 

    0
  • Alan Clack

    I ran into this issue today as well.

    The number field object will correctly follow the Custom or otherwise set number fields.
    Of interest, the object.value.display and object.value.numeric properties appear to be correct and usable as expected.

    However, neither of these tend to update the actual value in the field for the end user! Which without something like object.label or another similar property there just wasn't a good way to update what the user was seeing. =[
    This is pretty important for numbers where we don't want to bother with advanced regex and don't want things like comma/decimal separators or all the other power of custom formatting. I'm not certain this is a bug or an oversight as I'm not sure what the object.value.display is for otherwise… but I'd love to have that be what the user sees so updating it would be like updating a textBox label property as a simple option and we get all the power of the number fields without needing advanced regex for textBox fields instead.

    The display property can even be updated with no visual effect, which feels unintended?

    1
  • Ken Lyon

    The latest release of VertiGIS Studio Workflow (5.44) includes a fix for the “Fixed Point” format in VertiGIS Studio Web, which should produce the intended “plain” view of the number with no group characters etc. We also improved the support for regular expressions in Workflow 5.43.

    1
  • Alan Clack

    Ken Lyon 
    Hopefully that also works for other options as well, as this all the options worked for the object.value.display… but did not update the actual text in the number fields a user would see for any of the options like Fixed Point, Currency, Custom Format, etc...
    At least in version 5.40.1 that I had tested in.

    Thanks for the update! 👍

    0

Vous devez vous connecter pour laisser un commentaire.