Forums / Setup & design / Passing variables in url

Passing variables in url

Author Message

Alexander Petrov

Thursday 13 September 2007 12:26:58 am

I'm trying to pass variables to a form inside another document through the url.
Here is a link:

<a href={concat("/some_url/","/(param1)/",$node.data_map.attr1.content,"/(param2)/",$node.data_map.attr2.class_content.options[$node.data_map.attr2.value[0]].name)|ezurl}><img class="buy" src={"images/content/desc/buy.gif"|ezdesign} alt="" /></a>

First variable compares with elements values and if it equal put the "selected" attribute to make the needed option selected. But it's now working (.

<SELECT name="(filter)" size="1">
          {def $classAttribute=fetch( 'content', 'class_attribute', hash( 'attribute_id', 240 ) )}
              {def $options=$classAttribute.content.options}
                 {foreach $options as $option}
                   <option value="{$option.id}" {if eq($view_parameters.param1, $option.name}selected{/if}>{$option.name|wash( xhtml )}</option>
                 {/foreach}
		       {undef $options}
             {undef $classAttribute}
</SELECT>

Second variable come to input field value. I don't know how to put parameters in the {attribute_view_gui} so I just take the output code of the text field attribute at put the url variable insude the value="".

<input class="box" size="70" name="ContentObjectAttribute_ezstring_data_text_554" value="{$view_parameters.param2}" type="text">

The variable is displaying in the output html code, but is not visible on the rendered page. When I remove the "name="ContentObjectAttribute_ezstring_data_text_554" attribute the value is visible.

Need your help, please!

Olivier Ouin

Thursday 13 September 2007 8:55:57 am

First, we need to know what datatypes your using. I think that in your case, attr1 is a ezselection one.

If it's the case, you have to know that $node.data_map.attr1.content will contain the index of the selection, and not the text.
So you should test equality between $view_parameters.param1 and $option.id, and not $option.name.

Another thing, whatever which datatype is used, there is a missing parenthesis in {if eq($view_parameters.param1, $option.name}selected{/if} : the eq operator is not closed.

I don't see what could be the problem in your usage of the second parameter, but maybe it's related to the problem above ... the HTML generated code is maybe a bit altered by it.