After I submit the form unsuccessfully, the form looses all the values I typed in.
I'm using value="", so that could be related, but if I remove it I get a / in the field, and it still doesn't remember
any idea what I could be doing wrong?
well for now I've used a javascript to do this, it works well but maybe someone has a php/modx/eform solution.
By unsuccessfully submitting the form do you mean it fails validation checks?
No matter what I do, I can't replicate the behaviour you are seeing.
Okay, so I figured it out. I had all the intention of going in and adding the functionality, when I came across line 573 in eform.inc.php "# get SESSION data - thanks to sottwell"
so it's already doing what I want it to.
anyhow, because I couldn't find this in any documentation here is what I've done. Though I must say faintly recall doing this exact thing before. So the next time I need this I might come across this :)
add a value=[+field+]
<input id="femail" name="email" value="[+email+]" eform="Email Address:email:1" />
just remember that the value needs to match the class and NOT the id(unless you want them the same)
Related
I'm just trying to find a way to access the name property of an Area element inside Revit Python Shell, tried looking on Jeremy Tammik's amazingly informative blog, tried AUGI, Revit API docs, been looking for 2 days now...
Tried accessing via a bunch of ways, FilteredElementsCollector(doc).OfCategory(BuiltInCategory.OST_Areas), tried by Area class, tried through AreaTag, every single time I get an error under every circumstance and it's driving me nuts, it seems like such a simple issue that I can't seem to grasp!
EDIT: Also tried by element id, through tags, through area schemes, nada, no go...
Can anyone please tell me how to access this property via RPS?
I would say two things:
areaObject.LookupParameter("Name")
areaObject.GetParameters("Name")
...are valid methods. Please notice how I used GetParameters() NOT GetParameter(). There are some drawbacks to using either one of the two. The lookup method will return FIRST parameter that matches the name which in many cases might be a different parameter for different elements. It's not very reliable.
GetParameters() method will return them all if there are multiple so then you have to deal with a List<Parameter> rather than a single object that you can extract your value from.
I would personally recommend to use areaObject.get_Parameter(BuiltInParameter.ROOM_NAME) method to extract a Name value from Area object. The BuiltInParameter always points at the same parameter, and will reliably return just that one parameter. Here's a little more details about these methods:
http://www.revitapidocs.com/2018/4400b9f8-3787-0947-5113-2522ff5e5de2.htm
To answer my own question, I actually never thought of looking through the code of other Revit Python scripts... in this case of PyRevit, which is in my opinion far more eloquently written than RPS, raelly looking forward for their console work to be done!
Basically, I had mistakenly used GetParameter('parameter') instead of LookupParameter('parameter').
As I said, it was something stupidly simple that I just didn't understand.
If anyone has sufficient knowledge to coherently clarify this, please do answer!
Many thanks!
Maybe your issue is the same as this one ? :
https://groups.google.com/forum/#!searchin/RevitPythonShell/name|sort:relevance/revitpythonshell/uaxB1FLXG80/sdJNrTfoPuUJ
Your_Area.Name # throws error
Element.Name.GetValue(Your_Area) # works great
How do I show all validation errors from the modx register snippet?
Right now if I want to show all possible errors in my form I have to do something like this:
[[+error.message:notempty=`[[+error.message]]<br>`]]
[[+error.username:notempty=`[[+error.username]]<br>`]]
[[+error.password:notempty=`[[+error.password]]<br>`]]
[[+error.password_confirm:notempty=`[[+error.password_confirm]]<br>`]]
[[+error.email:notempty=`[[+error.email]]<br>`]]
[[+error.salutation:notempty=`[[+error.salutation]]<br>`]]
[[+error.firstname:notempty=`[[+error.firstname]]<br>`]]
[[+error.lastname:notempty=`[[+error.lastname]]<br>`]]
[[+error.institution:notempty=`[[+error.institution]]<br>`]]
[[+error.excountry:notempty=`[[+error.excountry]]<br>`]]
[[+error.province:notempty=`[[+error.province]]<br>`]]
[[+error.provinceother:notempty=`[[+error.provinceother]]<br>`]]
[[+error.excity:notempty=`[[+error.excity]]<br>`]]
[[+error.oncologist-database:notempty=`[[+error.oncologist-database]]<br>`]]
Does anyone know if there is a placeholder that just dumps all errors?
You say little to nothing about how the errors are generated in the snippet.
There are two approcahes to this. You could make the entire error-message into one in the snippet. That way you can simply concatenate them there. It would only require one placeholder in the chunk.
Or you could supply all the error-messages every time the chunk is displayed. The change is that when there are no error-messages, the placeholder is just empty (that way, you don't need to test with notempty). You could also make <br /> a part of the error-string itself. That way you don't need the query at all and you could just list each of the error-messages after each other. It would be "cleaner" in the chunk, but I prefer the first solution.
<div id="temp_1333021214801">
<input type="text"/>
</div>
$browser.text_field(:xpath,".//*[#id='temp_1333018770709']/input").set("apple")
I am getting error "unable to locate element", because the ID changes dynamically.
Please help me to set the text in the text field.
It seems like your dynamic id is temp_ so this should do it given information above:
browser.div(:id, /temp_\d+/).text_field.set 'something'
Issues with my solution is that it assumes id will always be temp_ regex matching any number set consecutively, which seems to be the case with your sample above. Also, it assumes there is no other div(:id, /temp_\d+/) combination in the DOM of that page, most likely should not be an issue.
If you have dynamic IDs I can suggest the following:
Code to object counts. For example
$browser.text_field(:index => 2)
gives the third text_field on the page.
Code to what is around the thing you're trying to find.
$browser.div(:name => 'mydiv').text_field(:index=>2)
gives the third text field in the div called 'mydiv'.
HOWEVER
If your front-end is less-than-testable in this way I highly suggest you put time into thinking over your commitment to automated testing in the first place. Any minor change to the software is going to have you working until 9pm pulling your hair out and rocking back and forth as you update all your scripts, so unless code maintenance is your weekend hobby think about semi-automation or exploratory testing or manual scripts. Talk to development (whomever that might be. It might be you!) or the higher-ups (unless that's you too) to see if it can be made more testable. Also don't use xpaths unless you take some deviant pleasure in it.
Hope that was helpful, I can't do anything specific without the source HTML.
i m using the rad masked control for phone field.
telerik:RadMaskedTextBox ID="txtPhone1" runat="server" EnableAjaxSkinRendering="False" Mask="(###) ###-####" Skin="Hay" ZeroPadNumericRanges="False" MaxLength="20" TabIndex="30" Width="200px"></telerik:RadMaskedTextBox
when i m trying to add phone using watir, using this code
browser.text_field(:id => 'ctl00_ContentPlaceHolder1_Registration2_txtPhone1_text').set '7893457889'
only last value has been added. kindly help me out. how to fill masked value.
Using Watir-webdriver and the example from Teleriks demo site, and IE browser, I was able to set the value with
browser.text_field(:id,"RadMaskedTextBox1_text").set '1234567890'
This seemed to work just as expected, added the formatting, and seemed functional to me.
With Watir I was able to set it via using
browser.text_field(:id, 'RadMaskedTextBox1_text').value='1234567890'
However although the value showed up in the field, it was not formatted and I was never able to get it to actually validate that input. I tried firing various events such as onchange, to get the client side code to process it, but no joy. If I was using this tool I might consider calling the vendor or getting on their site and asking them for assistance at this point. (provided you need to use Watir)
If watir-webdriver is not a viable option for you (I like it for cross browser testing) then perhaps someone else can spend the time to dig a bit deeper. (I'm personally past the point where digging into this control to extend my own knowledge is worth my employers time...)
Possibly there might be some way around this with Rautomation, but I'm new enough with it where I don't immediately see an easy solution there.
OMG. This is so old. But I am going to add to it. When dealing with masked elements, I am successful using the following sendkeys technique instead of injecting the value into the inner element text. Send Ctrl-A to highlight everything, then start typing, then tab out of control.
e = #browser.text_field(id: OrderEntryPOM.stop_window_start_date)
e.send_keys [:control, 'a'], start_date, :tab
Figured it out. LVIF_STATE should have been LVIF_IMAGE. See, I knew it was elementary...
I have a CListView derived class with an OnDoubleClick() handler in a VC++6.0 project. I need to persist the highlighting of the selected item after the OnDoubleClick() handler has done its thing. I had thought that
GetListCtrl().SetItemState(m_nHighlightIndex,LVIS_SELECTED, LVIF_STATE);
would do the trick (assuming that m_nHighlightIndex holds the index of the selected item), but no combination of that and various attempts to invalidate the client area has worked, in either OnDoubleClick() or OnUpdate(). This seems like such an elementary thing to do, but thus far it baffles me. Any help would be greatly appreciated.
Just so it looks answered (and apologies if this is bad form):
LVIF_STATE should have been LVIF_IMAGE. See, I knew it was elementary...