I'm trying to make it so certain buttons will be disabled if the Meteor app loses network connectivity.
For some reason, this code breaks. If I move the {{criticalButton}} elsewhere, like within <p> tags, it works fine. But within the <button>, and I get the error below.
HTML:
<button class="btn btn-primary" {{criticalButton}}>Update</button>
Coffee:
Template.registerHelper 'criticalButton', ->
return not Meteor.status().connected and 'disabled="disabled"'
Console error:
"Exception from Tracker recompute function: String contains an invalid character
AttributeHandler.prototype.update#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1057:4
ElementAttributesUpdater.prototype.update#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1372:6
.visitTag/updateAttributes#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1477:8
viewAutorun/</<#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1821:15
Template._withTemplateInstanceFunc#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:3382:11
viewAutorun/<#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1820:0
Blaze._withCurrentView#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:2105:11
viewAutorun#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1819:0
Tracker.Computation.prototype._compute#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:308:4
Tracker.Computation#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:224:4
Tracker.autorun#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:499:10
Blaze.View.prototype.autorun#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1831:13
.visitTag#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1482:10
.visit#http://localhost:3000/packages/htmljs.js?567eb96d5d22631c03d6aca6afa4c42f0d1295f2:103:0
.visitArray#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1416:6
.visit#http://localhost:3000/packages/htmljs.js?567eb96d5d22631c03d6aca6afa4c42f0d1295f2:116:0
.visitTag#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1495:30
.visit#http://localhost:3000/packages/htmljs.js?567eb96d5d22631c03d6aca6afa4c42f0d1295f2:103:0
doMaterialize#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1933:29
Tracker.nonreactive#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:525:11
doRender#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1931:6
viewAutorun/</<#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1821:15
Template._withTemplateInstanceFunc#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:3382:11
viewAutorun/<#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1820:0
Blaze._withCurrentView#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:2105:11
viewAutorun#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1819:0
Tracker.Computation.prototype._compute#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:308:4
Tracker.Computation#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:224:4
Tracker.autorun#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:499:10
Blaze.View.prototype.autorun#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1831:13
Blaze._materializeView/<#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1922:0
Tracker.nonreactive#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:525:11
Blaze._materializeView#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1921:2
.visitObject#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1513:21
.visit#http://localhost:3000/packages/htmljs.js?567eb96d5d22631c03d6aca6afa4c42f0d1295f2:118:13
doMaterialize#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1933:29
Tracker.nonreactive#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:525:11
doRender#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1931:6
viewAutorun/</<#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1821:15
Template._withTemplateInstanceFunc#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:3382:11
viewAutorun/<#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1820:0
Blaze._withCurrentView#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:2105:11
viewAutorun#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1819:0
Tracker.Computation.prototype._compute#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:308:4
Tracker.Computation#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:224:4
Tracker.autorun#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:499:10
Blaze.View.prototype.autorun#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1831:13
Blaze._materializeView/<#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1922:0
Tracker.nonreactive#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:525:11
Blaze._materializeView#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1921:2
.visitObject#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1513:21
.visit#http://localhost:3000/packages/htmljs.js?567eb96d5d22631c03d6aca6afa4c42f0d1295f2:118:13
doMaterialize#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1933:29
Tracker.nonreactive#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:525:11
doRender#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1931:6
viewAutorun/</<#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1821:15
Template._withTemplateInstanceFunc#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:3382:11
viewAutorun/<#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1820:0
Blaze._withCurrentView#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:2105:11
viewAutorun#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1819:0
Tracker.Computation.prototype._compute#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:308:4
Tracker.Computation#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:224:4
Tracker.autorun#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:499:10
Blaze.View.prototype.autorun#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1831:13
Blaze._materializeView/<#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1922:0
Tracker.nonreactive#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:525:11
Blaze._materializeView#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1921:2
.visitObject#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1513:21
.visit#http://localhost:3000/packages/htmljs.js?567eb96d5d22631c03d6aca6afa4c42f0d1295f2:118:13
doMaterialize#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1933:29
Tracker.nonreactive#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:525:11
doRender#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1931:6
viewAutorun/</<#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1821:15
Template._withTemplateInstanceFunc#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:3382:11
viewAutorun/<#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1820:0
Blaze._withCurrentView#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:2105:11
viewAutorun#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1819:0
Tracker.Computation.prototype._compute#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:308:4
Tracker.Computation#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:224:4
Tracker.autorun#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:499:10
Blaze.View.prototype.autorun#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1831:13
Blaze._materializeView/<#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1922:0
Tracker.nonreactive#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:525:11
Blaze._materializeView#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1921:2
.visitObject#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1513:21
.visit#http://localhost:3000/packages/htmljs.js?567eb96d5d22631c03d6aca6afa4c42f0d1295f2:118:13
.visitArray#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1416:6
.visit#http://localhost:3000/packages/htmljs.js?567eb96d5d22631c03d6aca6afa4c42f0d1295f2:116:0
doMaterialize#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1933:29
Tracker.nonreactive#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:525:11
doRender#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1931:6
viewAutorun/</<#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1821:15
Template._withTemplateInstanceFunc#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:3382:11
viewAutorun/<#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1820:0
Blaze._withCurrentView#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:2105:11
viewAutorun#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1819:0
Tracker.Computation.prototype._compute#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:308:4
Tracker.Computation#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:224:4
Tracker.autorun#http://localhost:3000/packages/tracker.js?21f0f4306879f57e10ad3a97efe9ea521c5b5775:499:10
Blaze.View.prototype.autorun#http://localhost:3000/packages/blaze.js?4e49999979a58da0e2265f7bd3f5910f9901b07b:1831:13"
Try this :
HTML
<button class="btn btn-primary" disabled="{{criticalButton}}">
Update
</button>
Coffee
Template.registerHelper 'criticalButton', ->
return not Meteor.status().connected
You can return a boolean value from a Blaze helper to indicate the value of a "boolean" HTML attribute like disabled, checked, required, etc...
Related
Im Using Quasar and Firebase
I Get FirebaseError: Missing or insufficient permissions. error on console
error
Script:
// gets from the firebase
const path = "/newpage";
this.$auth.onAuthStateChanged(authUser => {
if (authUser) {
this.$bind('userz', this.$db.collection('users'));
this.$db.collection('users').doc(authUser.uid).get()
.then(snapshot => {
const userData = snapshot.data();
console.log(userData);
(this.$route.path !== path);
this.$router.push(path).catch(err => {});
this.livePaper = false;
})} else {
this.livePaper = true;
console.log('user logged out');
this.$router.push('/Login').catch(err => {});
}
})
},
whenever I put
```this.$bind('userz', this.$db.collection('users'));```
missing permission happens
but when i remove the bind
It has no errors
though
I want to get the username: value in the field and put it on my nav
firebase - username
``` <li v-for="(users, uid) in userz" :key="uid">
{{users.username}} <q-btn v-on:click="livePaper = true" label="Sign Out" #click="logOut()" color="green"/>
```
But i cant get it unless i remove
```this.$db.collection('users').doc(authUser.uid).get()
.then(snapshot => {
const userData = snapshot.data();
console.log(userData);```
again when i remove it missing permission happens again.
what should I do
Whole Code:
<template>
<q-layout view="hHh lpR fFf">
<q-header elevated class="bg-primary text-white">
<q-toolbar>
<q-btn v-if="!livePaper" dense flat round icon="menu" #click="left = !left" />
<q-toolbar-title>
<q-avatar>
<img src="https://cdn.quasar.dev/logo/svg/quasar-logo.svg">
</q-avatar>
Title
</q-toolbar-title>
<div class="q-pa-md hid" v-if="!livePaper">
<li v-for="(users, uid) in userz" :key="uid">
{{users.username}} <q-btn v-on:click="livePaper = true" label="Sign Out" #click="logOut()" color="green"/>
</li>
</div>
</q-toolbar>
</q-header>
<q-drawer v-if="!livePaper" show-if-above v-model="left" side="left" bordered>
<!-- drawer content -->
<q-scroll-area style="height: calc(100% - 150px); margin-top: 150px; border-right: 1px solid #ddd">
<q-list padding>
<q-item clickable v-ripple>
<q-item-section avatar>
<q-icon name="inbox" />
</q-item-section>
<q-item-section>
Inbox
</q-item-section>
</q-item>
<q-item clickable v-ripple>
<q-item-section avatar>
<q-icon name="star" />
</q-item-section>
<q-item-section>
Star
</q-item-section>
</q-item>
<q-item clickable v-ripple>
<q-item-section avatar>
<q-icon name="send" />
</q-item-section>
<q-item-section>
Send
</q-item-section>
</q-item>
<q-item clickable v-ripple>
<q-item-section avatar>
<q-icon name="drafts" />
</q-item-section>
<q-item-section>
Drafts
</q-item-section>
</q-item>
<q-item #click="icon = true" clickable v-ripple>
<q-item-section avatar>
<q-dialog v-model="icon">
<q-card style="width: 570px; max-width: 80vw;" class= "q-pa-xl ">
<q-card-section class="row items-center q-pb-none ">
<div class="text-h6">Sign Up</div>
<q-space />
<q-btn icon="close" flat round dense v-close-popup />
</q-card-section>
<q-separator />
<q-card-section >
<q-input filled v-model="usrnm" label="Username" id="usrnm" lazy-rules
:rules="[ val => val && val.length > 0 || 'Please type something']"
/>
<q-input filled v-model="eml" label="Email" id="eml" lazy-rules
:rules="[ val => val && val.length > 0 || 'Please type something']"
/>
<q-input
filled
type="password"
v-model="pswrd"
id="pswrd"
label="Password"
lazy-rules
:rules="[ val => val && val.length > 0 ||'Please type a real age'
]"
/>
<div>
<q-btn label="Sign Up" type="submit" color="primary" #click="signUps()" />
</div>
</q-card-section>
</q-card>
</q-dialog>
<q-icon name="person_add" />
</q-item-section>
<q-item-section>
Sign Up
</q-item-section>
</q-item>
</q-list>
</q-scroll-area>
<q-img class="absolute-top" src="https://cdn.quasar.dev/img/material.png" style="height: 150px">
<div class="absolute-bottom bg-transparent">
<q-avatar v-ripple size="56px" class="q-mb-sm">
<img src="https://cdn.quasar.dev/img/boy-avatar.png">
</q-avatar>
<div class="text-weight-bold"></div>
<div>#rstoenescu</div>
</div>
</q-img>
</q-drawer>
<q-page-container>
<router-view />
</q-page-container>
</q-layout>
</template>
<script>
export default {
data () {
return {
left: false,
userz: [],
livePaper: false,
icon: false,
eml: '',
pswrd: '',
usrnm: '',
index: 0
}
},
created() {
// gets from the firebase
const path = "/newpage";
this.$auth.onAuthStateChanged(authUser => {
if (authUser) {
this.$db.collection('users').doc(authUser.uid)
.get()
.then(snapshot => {
const userData = snapshot.data();
console.log(userData);
(this.$route.path !== path);
this.$router.push(path).catch(err => {});
this.$bind('userz', this.$db.collection('users').doc(authUser.uid));
this.$bind('userz', this.$db.collection('users'));
this.livePaper = false;
})} else {
this.livePaper = true;
console.log('user logged out');
this.$router.push('/Login').catch(err => {});
}
})
},
methods: {
logOut(){
this.$auth.signOut();
this.livePaper = true;
},
signUps() {
this.$auth.createUserWithEmailAndPassword(this.eml, this.pswrd).then(cred => {
return this.$db.collection('users').doc(cred.userz.uid).set({
email: this.eml,
username: this.usrnm
});
this.isEdit = false
this.text = ''
this.yr = ''
}).then;(() => {
});
// ...
}
}
}
</script> ```
This might be a duplicate thread of
firestore: PERMISSION_DENIED: Missing or insufficient permissions, at least this is where i got help for this problem.
After setting up the rules in a proper way, the error will disappear. I had the same problem with the quasar firebase sample app too.
Here are the docs for your the firebase rules that contain all the details for setting up the rules:
https://firebase.google.com/docs/firestore/security/get-started
basically the line
allow read, write: if false;
is the problem, you could change it to the following to allow only signed in users to access the database:
allow read, write: if request.auth != null;
the following code is not recommendable because it enables unauthenticated access to your database, so don't use it unless you are in a testing scenario:
allow read, write: if false;
When creating a folder rule with rule criteria 'Has tag', the Select Tag panel doesn't display all tags
I have tried creating a tag by adding a tag in the file properties but it's still not showing
I checked the tag management, it's not showing there either!
I'm using activiti for managing workflows, and I tried adding tags like it shows in the code below:
<userTask id="reviewTask" name="Review Task"
activiti:formKey="wfa:activitiReviewTaskk">
<extensionElements>
<activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
</activiti:string>
</activiti:field>
</activiti:taskListener>
<activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
execution.setVariable('wfa_reviewOutcome', task.getVariable('wfa_reviewOutcome'));
if (task.getVariable('wfa_reviewOutcome') == 'Approve')
{
bpm_package.children[0].addTag("Approved");
}
else
{
if (task.getVariable('wfa_reviewOutcome') == 'Reject')
{
bpm_package.children[0].addTag("Rejected");
}
}
</activiti:string>
</activiti:field>
<activiti:field name="runAs">
<activiti:string>admin</activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
<humanPerformer>
<resourceAssignmentExpression>
<formalExpression>${bpm_assignee.properties.userName}</formalExpression>
</resourceAssignmentExpression>
</humanPerformer>
</userTask>
The tags are added but still not showing in the tags management!
I fixed the problem by performing a reindex of SOLR by following the steps in this link, http://docs.alfresco.com/5.0/tasks/solr-reindex.html :
Delete the content of the directories
..\alf_data\solr4\index\workspace\SpacesStore\ and
..\alf_data\solr4\index\archive\SpacesStore\
Delete all the files in ..\alf_data\solr4\model
I am trying to show/hide on click of some image, but the formatting of the tr is going terribly wrong. Am I doing something wrong?? Attached is the result. I have also tried adding custom formatting but wont worked either.
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:div style="position:relative;">
<xp:table id="table1">
<xp:tr style="width:100%">
<xp:td>a</xp:td>
<xp:td>b</xp:td>
<xp:td>c</xp:td>
<xp:td>d</xp:td>
<xp:td>e</xp:td>
</xp:tr>
<xp:tr id="tr0" style="width:100%">
<xp:td><xp:comboBox id="Vnr">
</xp:comboBox></xp:td>
<xp:td><xp:comboBox id="comboBox1"></xp:comboBox></xp:td>
<xp:td id="td1"><xp:image url="./add.png" id="image23">
<xp:eventHandler event="onclick" submit="false"
id="eventHandler3">
<xp:this.script><![CDATA[var tr0 = document.getElementById("#{id:tr1}");
tr0.style.display = "block";
]]></xp:this.script>
</xp:eventHandler>
</xp:image>
<xp:eventHandler event="onclick" submit="false">
<xp:this.script><![CDATA[var tr0 = document.getElementById("#{id:tr1}");
tr0.style.display = "block";]]></xp:this.script>
</xp:eventHandler></xp:td>
<xp:td></xp:td>
<xp:td></xp:td>
</xp:tr>
<xp:tr id='tr1' style="width:100%;display:none;">
<xp:td>
<xp:comboBox id="comboBox2"></xp:comboBox>
</xp:td>
<xp:td>
<xp:comboBox id="comboBox3" style=""></xp:comboBox>
</xp:td>
<xp:td>
<xp:image url="./add.png" id="image1">
<xp:eventHandler event="onclick" submit="false"
id="eventHandler1">
<xp:this.script><![CDATA[var tr0 = document.getElementById("#{id:tr2}");
tr0.style.display = "block";
]]></xp:this.script>
</xp:eventHandler>
</xp:image>
</xp:td>
<xp:td></xp:td>
<xp:td></xp:td>
</xp:tr>
<xp:tr id="tr2" style="display:none;">
<xp:td>
<xp:comboBox id="comboBox4"></xp:comboBox>
</xp:td>
<xp:td>
<xp:comboBox id="comboBox5"></xp:comboBox>
</xp:td>
<xp:td>
<xp:image url="./add.png" id="image2">
</xp:image>
</xp:td>
<xp:td></xp:td>
<xp:td></xp:td>
</xp:tr></xp:table></xp:div></xp:view>
Just delete/empty the display style class with
var tr = document.getElementById("#{id:tr1}");
tr.style.display = "";
Then you get the default behavior: a table row in this case.
I am trying to write an xquery statement that transforms the following cdcatalog.xml in order to change the 'country' element to be an attribute on the 'cd' element and add an 'id' attribute to the 'cd' element that is an incremented integer (1,2,3...). Does the FLOWR apply here or I have to use other functions in order add and perform the changes?
The cdcatalog.xml is the following:
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
<cd>
<title>Hide your heart</title>
<artist>Bonnie Tyler</artist>
<country>UK</country>
<company>CBS Records</company>
<price>9.90</price>
<year>1988</year>
</cd>
<cd>
<title>Greatest Hits</title>
<artist>Dolly Parton</artist>
<country>USA</country>
<company>RCA</company>
<price>9.90</price>
<year>1982</year>
</cd>
<cd>
<title>Still got the blues</title>
<artist>Gary Moore</artist>
<country>UK</country>
<company>Virgin records</company>
<price>10.20</price>
<year>1990</year>
</cd>
</catalog>
And the output should be like this
<catalog>
<cd id="1" country="USA">
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
<cd id="2" country="UK">
<title>Hide your heart</title>
<artist>Bonnie Tyler</artist>
<company>CBS Records</company>
<price>9.90</price>
<year>1988</year>
</cd>
element catalog {
for $cd at $pos in doc('cdcatalog.xml')/catalog/cd
return
element cd {
attribute id { $pos },
attribute country { $cd/country },
$cd/* except $cd/country
}
}
I am using the Opus iMacros add-on with Internet Explorer. The following Macro takes a variable from the first line of my excel CSV File and performs a search on a website. The search results from the website may be anywhere from 10 to 200 records, which are grouped 20 per page (1-10 pages). The macro then extracts each page to a text file for future reference.
SET !ERRORIGNORE YES
SET !EXTRACT_TEST_POPUP NO
TAB T=1
TAB CLOSEALLOTHERS
SET !DATASOURCE 7Digits.csv
SET !DATASOURCE_Columns 1
SET !DATASOURCE_LINE {{!LOOP}}
'Login
URL GOTO=https://SomeWebsite.com/login
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:form1 ATTR=NAME:USER_NAME CONTENT=ABC123
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:form1 ATTR=NAME:PASSWORD CONTENT=XXX
'set search criteria on multiple search page
TAG POS=1 TYPE=TEXTAREA FORM=NAME:form1 ATTR=NAME: NUMBER CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:IMAGE FORM=NAME:form1 ATTR=ID:SEARCH
‘Extract results and SAVE
TAG POS=1 TYPE=A ATTR=TXT:1
TAG POS=2 TYPE=TABLE ATTR=TXT:*location* EXTRACT=TXT
SAVEAS TYPE=txt FOLDER=* FILE=mytable_{{!NOW:yymmdd_hhnnss}}
TAG POS=1 TYPE=A ATTR=TXT:2
TAG POS=2 TYPE=TABLE ATTR=TXT:*location* EXTRACT=TXT
SAVEAS TYPE=txt FOLDER=* FILE=mytable_{{!NOW:yymmdd_hhnnss}}
TAG POS=1 TYPE=A ATTR=TXT:3
TAG POS=2 TYPE=TABLE ATTR=TXT:*location* EXTRACT=TXT
SAVEAS TYPE=txt FOLDER=* FILE=mytable_{{!NOW:yymmdd_hhnnss}}
TAG POS=1 TYPE=A ATTR=TXT:4
TAG POS=2 TYPE=TABLE ATTR=TXT:*location* EXTRACT=TXT
SAVEAS TYPE=txt FOLDER=* FILE=mytable_{{!NOW:yymmdd_hhnnss}}
TAG POS=1 TYPE=A ATTR=TXT:5
TAG POS=2 TYPE=TABLE ATTR=TXT:*location* EXTRACT=TXT
SAVEAS TYPE=txt FOLDER=* FILE=mytable_{{!NOW:yymmdd_hhnnss}}
TAG POS=1 TYPE=A ATTR=TXT:6
TAG POS=2 TYPE=TABLE ATTR=TXT:*location* EXTRACT=TXT
SAVEAS TYPE=txt FOLDER=* FILE=mytable_{{!NOW:yymmdd_hhnnss}}
TAG POS=1 TYPE=A ATTR=TXT:7
TAG POS=2 TYPE=TABLE ATTR=TXT:*location* EXTRACT=TXT
SAVEAS TYPE=txt FOLDER=* FILE=mytable_{{!NOW:yymmdd_hhnnss}}
TAG POS=1 TYPE=A ATTR=TXT:8
TAG POS=2 TYPE=TABLE ATTR=TXT:*location* EXTRACT=TXT
SAVEAS TYPE=txt FOLDER=* FILE=mytable_{{!NOW:yymmdd_hhnnss}}
TAG POS=1 TYPE=A ATTR=TXT:9
TAG POS=2 TYPE=TABLE ATTR=TXT:*location* EXTRACT=TXT
SAVEAS TYPE=txt FOLDER=* FILE=mytable_{{!NOW:yymmdd_hhnnss}}
TAG POS=1 TYPE=A ATTR=TXT:10
TAG POS=2 TYPE=TABLE ATTR=TXT:*location* EXTRACT=TXT
SAVEAS TYPE=txt FOLDER=* FILE=mytable_{{!NOW:yymmdd_hhnnss}}
'END
My challenge is to figure out a way to cancel the “SAVEAS” if there are less than 10 pages of search results. For instance, if the search only returns 60 results, the Macro only needs to perform the SAVEAS command 3 times (20 x 3). How can I move to the next {{!LOOP}} without saving the same text file 7 more times?
I have tried the “!FAIL_ON_ALL_NAVIGATEERRORS” command, but the macro stops entirely. I would like to move to the next record instead of stopping the macro.
This is how you convert iMacros code to JavaScript.
How to invoke an iMacro from JavaScript?
Also your question holds an answer because you asked " if there are less then ". So you have to convert to code to JS and use if clauses.
You can do it by imacro javascript if formula.
if(search result<10) {
perform your script
}else { go to next page }