Friday, January 25, 2013

Rename your submit buttons

Currently you never add a submit button to a Form in Cloud App Studio - it is always there and is always just a plain submit without any value (=label on the button).

This means it will take the locale settings from your browser and set value to "submit" or what is set the corresponding value for your language.

Until properties for a submit button is added to the Form builder, you can use a page with your Form being embedded and add the following code:

First you need to make sure jquery and jqueryUIis part of your form.
Secondly add the Form (embedded).
And last add the last script tag and modify the value of the "label"


<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/jquery-ui.min.js" type="text/javascript"></script>

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/themes/ui-lightness/jquery-ui.css" type="text/css" />

<script type='text/javascript' src='/app/@context("app","name")/inject-form/fu680xcs?style=basic'></script> 

  
<script>
  //Check if form is loaded every second, when loaded rename submit button to skicka
  function renameSubmitButton(){
  if($(".amantech-se-inject-form > input[type=submit]").size() == 0){
  setTimeout(renameSubmitButton, 1000);  
  }
    else{

          $(".amantech-se-inject-form > input[type=submit]").val("This is the new label on your submit button");
    }
  }
  renameSubmitButton();
</script>

No comments:

Post a Comment