Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
HTML
<a href="https://wiki.vertuna.com/display/TEST/How+to+create+a+link+to+a+page+to+preset+the+value+for+ConfiForms+fields?cf_name=myform&cf_values=mytext:hello;another:world">Click on link to preset the form values</a>
ConfiForms Form Definition
formNamemyform
true

 

mytextMy texttext

anotherAnother fieldtextarea

Create PageonCreatedMy page

Here goes the content of

the page

HTML
<script>
	function setValues2ConfiForm(link) {
		var params = ['mytext', 'another'];
		var vals = new Array();
        var idx = 0;
		AJS.$(link).closest('td').siblings().each(function() {
			vals[idx++] = AJS.$(this).text();
		});
 
		var formParams = '';
		for (i=0;i<params.length;i++) {
			formParams = formParams + params[i] + ':' + vals[i] + ';'
		}
		document.location ='https://wiki.vertuna.com/display/TEST/form+preset+from+table+rows+simple+demo?cf_name=myform&cf_values=' + formParams;
	}
</script>
mytextanother 
some values here and theres234
HTML
<a href="#" onclick="setValues2ConfiForm(this)">create</a>
not read508
HTML
<a href="#" onclick="setValues2ConfiForm(this)">create</a>

 

 

 

...

 

Source:

Expand
Code Block
<ac:structured-macro ac:macro-id="a9966578-8b17-4c82-91a5-2ae812850287" ac:name="confiform" ac:schema-version="1">
  <ac:parameter ac:name="formName">myform1</ac:parameter>
  <ac:rich-text-body>
    <ac:structured-macro ac:macro-id="5602f2ac-9b2c-4c89-a8c6-38aebc034b75" ac:name="confiform-entry-register" ac:schema-version="1">
      <ac:parameter ac:name="embedded">true</ac:parameter>
      <ac:rich-text-body>
        <p> </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <p>
      <ac:structured-macro ac:macro-id="0e2ee8b6-1b8b-4624-891a-a7a6c9421b25" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">mytext</ac:parameter>
        <ac:parameter ac:name="fieldLabel">My text</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="4ce46418-1c61-4a2e-9126-f3463ce71f0e" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">another</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Another field</ac:parameter>
        <ac:parameter ac:name="type">textarea</ac:parameter>
      </ac:structured-macro>
    </p>
  </ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="105d054d-18a0-40e3-bb8c-ee94566f1ab9" ac:name="html" ac:schema-version="1">
  <ac:plain-text-body><![CDATA[<script>
	function setValues2ConfiForm(link) {
		var params = ['mytext', 'another'];
		var vals = new Array();
        var idx = 0;
		AJS.$(link).closest('td').siblings().each(function() {
			vals[idx++] = AJS.$(this).text();
		});
 
		var formParams = '';
		for (i=0;i<params.length;i++) {
			formParams = formParams + params[i] + ':' + vals[i] + ';'
		}
 
		document.location ='https://wiki.vertuna.com/display/TEST/form+preset+from+table+rows+simple+demo?cf_name=myform1&cf_values=' + formParams;
	}
</script>]]></ac:plain-text-body>
</ac:structured-macro>
<table>
  <tbody>
    <tr>
      <th>mytext</th>
      <th>another</th>
      <th> </th>
    </tr>
    <tr>
      <td>some values here and there</td>
      <td>s234</td>
      <td>
        <ac:structured-macro ac:macro-id="a0d5a07e-4ecf-495d-9c53-a69fe33d9137" ac:name="html" ac:schema-version="1">
          <ac:plain-text-body><![CDATA[<a href="#" onclick="setValues2ConfiForm(this)">create</a>]]></ac:plain-text-body>
        </ac:structured-macro>
      </td>
    </tr>
    <tr>
      <td>not read</td>
      <td>508</td>
      <td>
        <ac:structured-macro ac:macro-id="82f07aea-d6b5-4e9d-afa8-8c7a3b4504ae" ac:name="html" ac:schema-version="1">
          <ac:plain-text-body><![CDATA[<a href="#" onclick="setValues2ConfiForm(this)">create</a>]]></ac:plain-text-body>
        </ac:structured-macro>
      </td>
    </tr>
  </tbody>
</table>
<ac:structured-macro ac:macro-id="6bbcd185-5ef9-4d4f-9da5-b3429124d2ca" ac:name="html" ac:schema-version="1">
  <ac:plain-text-body><![CDATA[<a href="https://wiki.vertuna.com/display/TEST/form+preset+from+table+rows+simple+demo?cf_name=myform1&cf_values=mytext:hello;another:world">just a hello world link</a>]]></ac:plain-text-body>
</ac:structured-macro>