Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Alternative form macro/value View modes: 
User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 6/14/2013 12:52:26 AM
   
Alternative form macro/value
I have an alternative form and I'm attempting to create a dynamic link like so
edit.asxp?id={%ItemID%}
And it never returns a value. How do I go about getting the value of a field within an alternative form without having it wrapped with HTML or in some label? Is there a $$value:ItemID$$ type macro?

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 6/17/2013 1:41:42 AM
   
RE:Alternative form macro/value
Hi,

Please, correct me if I am wrong.

You have a form - one of the fields is the ItemID and you want to get the submitted value of this field to the URL query string parameter?

If so, this would require bit more coding in the code behind. You will need to access the BasicForm and get the data from given form fields and add the value to the URL using C#.

To get the value from the form you can use e.g. (this is code sample from accessing a bizform field in the code behind):

viewBiz.BasicForm.GetDataValue("FirstName");


This webinar talks about how the Form engine works - if you will have some time some day, I would recommend watching it.

Best regards,
Juraj Ondrus

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 6/17/2013 6:27:53 AM
   
RE:Alternative form macro/value
So what I have is a list of items and when I click on "view" button, it opens a modal window with an alternative form for that object that has the labels I've specified as well as an edit and cancel button in it. The cancel button simply closes the modal window the edit button directs them to a page with an alternative form with the full set of fields. All I want to do is in the "View" alternate form simply grab the value of a column to put in a string (make the url for the edit button). I don't want to use $$value:ItemID because it either returns a <span> or a <input> tag. Or maybe there is a way to get it from when the modal window is opened. I'm using the ItemID as the ID to open the window.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 6/24/2013 6:18:06 AM
   
RE:Alternative form macro/value
Hi,

for which object is the alternative form? For custom tables, there are no macros to get the value, but for other forms there should be a way. It may not be directly and simply in the context macro, but you may need to get it from some name space and class using K# or, another way is custom macro using the API.


Best regards,
Juraj Ondrus

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 6/24/2013 6:28:22 AM
   
RE:Alternative form macro/value
It's for a custom table item. How would I go about it with a another form via namespace and class?

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 6/25/2013 1:48:14 AM
   
RE:Alternative form macro/value
Hi,

I meant e.g. for a document type field - even if an alternative form is used, you can get the values e.g. from the PageInfo in the macro from the document/node data directly.

For biz forms and custom tables, you need to use custom macro at this moment. There will be support in macros for them in version 8.


Best regards,
Juraj Ondrus