I have text-input-boxes on a website which I´m accessing via XQuery. Something like this on the website:
<input id="input1" type="text" value="300">
I need to access the "value" fields, but I´m missing the idea here how to do this.
Here´s the code I´ve tried:
let $doc := html:parse(fetch:binary('websiteaddress'))
return
<datarow>
<input1>{data($doc/html/body/div/div/div/div/div)}
</input1>
</datarow>
As result I get all the description text on the website, but not the fields itself.
At the end I would need datarows with the "value". So I guess I have to do something like $doc//div[#id="input1"]?....but how to access the value?
Any ideas on that?
You can access the attribute values with the attribute axis.
Most people use the abbreviated syntax #:
$doc//input[#id="input1"]/#value
but you can also use attribute:::
$doc//input[#id="input1"]/attribute::value
Related
<input type="hidden" name="formid" class="Field FieldDescriptor" value="777">
I would like to return 777 as "formid" variable in Google Tag Manager. When I test it, it returns as undefined.
What do I need to do to have GTM pull "777" as the "formid" value?
Thanks in advance
You have formid as a data layer variable. To get it as a data layer variable, you first have to push it into the dataLayer array from the global scope.
But that's not what you want. Now, how do you get a formID value? depends on when you need it. The simplest way would be just pulling it through a JS variable that would look like so:
function(){
return document.querySelector('input[type="hidden"][name="formid"][class="Field FieldDescriptor"]').value;
}
Note that it depends on certain input attributes and their values. The selector may be adjusted depending to your needs, but that would be a separate issue.
I have a large model with many levels and attributes and I want to have one Input in my XML view which will always edit 1 attribute from the model, but every time it will be a different attribute.
I want to edit for example attributes on following paths:
myModel>/user/0/surname
myModel>/user/1/name
myModel>/user/2/nickname
myModel>/user/3/email
Let's say that now I am interested in editing the nickname of user nr2 so I will save its path to a variable:
myModel.setProperty("currentlyEditedPath", "myModel>/user/2/nickname");
And I want to define my Input like this:
<Input value="{myModel>/currentlyEditedPath}" >
And what happens is that UI5 will allow me to edit the string "myModel>/user/2/nickname" it self. But its wrong. I only want to use the string as a reference to some other value deep in the model which should be modified and updated. I should probably write something like this, but I cannot find the correct way:
<Input value="{ ${myModel> ${myModel>/currentlyEditedPath} } } " >
Any ideas, please? .. as simple as possible. Best inline.
I think the Element binding is the good way. Feel free to comment on this:
var oInput = sap.ui.core.Fragment.byId("myFragmentID","myInputID");
oInput.bindElement("myModel>/user/2");
oInput.bindProperty("value", "myModel>nickname");
Or I can also place the value to the XML:
<Input value="{myModel>nickname}" >
I'm working on a Symfony site which incorporates a scheduler, and on this scheduler there are tasks which have user's names on them. My client has requested that only the surname be shown but currently the database saves the name as a complete string named contactName.
I am currently using the following code in Twig to display the name:
schedule.user.contactName
I tried using the split command, which seemed to do what I want:
schedule.user.contactName|split(" ",1)
But this only returns an array, and I do not know how to take the surname from this.
Any help with this is appreciated - maybe there is an alternative way to do this?
Maybe you could try this:
schedule.user.contactName|split(' ', 2)|first
There are two ways I can think of:
Set the output of the split function as a new variable, and since it's an array, you should be able to get name[1], or maybe name.1 from it for the 2nd part (if it exists, and your customer is not 'Cher', 'Prince', or the like).
It's probably easier to do it in two parts like this, rather than trying to combine it to a single statement.
{% set nameParts = schedule.user.contactName|split(" ",1) %}
{{ nameParts[1]|default(schedule.user.contactName) }}
You can also perform the split within the entity - getContactNameSurname() that does the split in PHP code, and returns the 2nd part.
I'm just a little desperate.
I installed the RSS Display extension.
http://typo3.org/extensions/repository/view/rss_display
Everything works fine, but I have just a little understanding problem.
I pull myself with fluid the Author for the current feed.
<feed:item.get value="author"/>
Than i look whats inside.
<f:debug><feed:item.get value="author"/></f:debug>
Thats the result.
SimplePie_Author prototype object
name => 'Name Name' (12 chars)
link => NULL
email => NULL
So what i need it's to get the name of the author.
Unfortunately i am not able to get the value.
I am really new in Fluid, Typo3.
Hopefully someone can help me.
One way to do this, is to create a fluid variable author and assign the author object to it. Then you can access the name using {author.name}.
To create a variable, you could use the ViewHelper <f:alias>, like this:
<f:alias map="{author: '{feed:item.get(value: \'author\')}'}">
{author.name}
</f:alias>
Another way would be to use the extension "vhs", which provides many tools for use with fluid. One of these tools is the ViewHelper <v:variable.set>, which could be used like this:
<v:variable.set name="author" value="{feed:item.get(value: 'author\'}"/>
{author.name}
This has the advantage that you don't need to use the variable within the tags of the ViewHelper.
There are other ways to reach the same goal, without defining variables, but this seems to be the easiest one to me.
I want to make some fields (checkboxes) readonly if the record is saved. the next assigned person can change in some fields. But some fields must be restricted that no body can change them. One way is to do so is to put user or group rights. But I want it in another way. Any way there?
This condition is work perfectly
<field name="freezing_on_all_channels" attrs="{'readonly':[('id','!=', False)]}"/>
or attrs="{'readonly':[('id','!=',0)]}" (note: the 0 not in quotes '0'),
you just made one mistake; if you put
<"field name="id" invisible="1"/> in the view as well, then it will work as expected.
Thanks
It's possible when state is change.
You can do it by writing "attrs={}" attribute in your .xml.
For example:
< field name="your_field" attrs="{'readonly':[('state','=','saved')]}"/>
Hope this will solve your problem.
Thank You...
try with below
'your_field': fields.char('Name', type='char',store=True,readonly=True),